【发布时间】:2020-03-16 11:01:32
【问题描述】:
我想在 DBMS_STATS.GATHER_SCHEMA_STATS 中使用选择查询,但我写的代码返回错误。
EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS((select sys_context( 'userenv','current_schema') from dual));
查询:select sys_context('userenv','current_schema') from dual;返回架构名称。
这是我的错误:
Error starting at line : 1 in command -
BEGIN DBMS_STATS.GATHER_SCHEMA_STATS((select sys_context( 'userenv','current_schema') from dual)); END;
Error report -
ORA-06550: line 1, column 39:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
continue avg count current exists max min prior sql stddev
sum variance execute forall merge time timestamp interval
date <a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<alternatywnie oznaczany literał napisowy ze specyfikacją zestawu znaków>
<alternatywn
ORA-06550: line 1, column 96:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
. , @ ; for <an identifier>
<a double-quoted delimited-identifier> group having intersect
minus order partition start subpartition union where connect
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
【问题讨论】:
-
为什么不
DBMS_STATS.GATHER_SCHEMA_STATS(USER);