首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Oracle,在DBMS_STATS.GATHER_SCHEMA_STATS中选择

Oracle,在DBMS_STATS.GATHER_SCHEMA_STATS中选择
EN

Stack Overflow用户
提问于 2020-03-16 11:01:32
回答 1查看 230关注 0票数 0

我想在DBMS_STATS.GATHER_SCHEMA_STATS中使用选择查询,但是我编写的代码返回一个错误。

代码语言:javascript
复制
EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS((select sys_context( 'userenv','current_schema') from dual));

查询:从dual中选择sys_context( 'userenv','current_schema');返回模式名称。

这是我的错误:

代码语言:javascript
复制
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:
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-16 11:06:55

你太接近了。不需要使用SELECT .. FROM DUAL

使用以下代码:

代码语言:javascript
复制
EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS(sys_context( 'userenv','current_schema'));

干杯!!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60704732

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档