简体   繁体   English

Oracle PLSQL,在 DBMS_STATS.GATHER_SCHEMA_STATS 中选择

[英]Oracle PLSQL, select in DBMS_STATS.GATHER_SCHEMA_STATS

I want to usue select query in DBMS_STATS.GATHER_SCHEMA_STATS but the code I wrote returns an error.我想在 DBMS_STATS.GATHER_SCHEMA_STATS 中使用选择查询,但我编写的代码返回错误。

EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS((select sys_context( 'userenv','current_schema') from dual));

The query: select sys_context( 'userenv','current_schema') from dual;查询: select sys_context('userenv','current_schema') from dual; returns the schema name.返回架构名称。

And this is my error:这是我的错误:

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:

You are too close.你太近了。 No need to use SELECT .. FROM DUAL无需使用SELECT .. FROM DUAL

Use the following code:使用以下代码:

EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS(sys_context( 'userenv','current_schema'));

Cheers!!干杯!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM