dbTalk Databases Forums  

using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kevin S
 
Posts: n/a

Default using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 05:53 AM






When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4

Reply With Quote
  #2  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 08:26 AM







"Kevin S" <SearleK (AT) googlemail (DOT) com> wrote

Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
You don't need the ; inside the quotes. Also the load etc strings need to
be single quoted not double quoted.'
Jim




Reply With Quote
  #3  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 08:26 AM




"Kevin S" <SearleK (AT) googlemail (DOT) com> wrote

Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
You don't need the ; inside the quotes. Also the load etc strings need to
be single quoted not double quoted.'
Jim




Reply With Quote
  #4  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 08:26 AM




"Kevin S" <SearleK (AT) googlemail (DOT) com> wrote

Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
You don't need the ; inside the quotes. Also the load etc strings need to
be single quoted not double quoted.'
Jim




Reply With Quote
  #5  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 08:26 AM




"Kevin S" <SearleK (AT) googlemail (DOT) com> wrote

Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
You don't need the ; inside the quotes. Also the load etc strings need to
be single quoted not double quoted.'
Jim




Reply With Quote
  #6  
Old   
Michel Cadot
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 10:37 AM




"Kevin S" <SearleK (AT) googlemail (DOT) com> a écrit dans le message de news:
c285fc93-2f58-4acb-b9e3-083caa86d366...oglegroups.com...
Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
Also EXEC is a SQL*Plus command not a PL/SQL one.

Regards
Michel




Reply With Quote
  #7  
Old   
Michel Cadot
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 10:37 AM




"Kevin S" <SearleK (AT) googlemail (DOT) com> a écrit dans le message de news:
c285fc93-2f58-4acb-b9e3-083caa86d366...oglegroups.com...
Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
Also EXEC is a SQL*Plus command not a PL/SQL one.

Regards
Michel




Reply With Quote
  #8  
Old   
Michel Cadot
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 10:37 AM




"Kevin S" <SearleK (AT) googlemail (DOT) com> a écrit dans le message de news:
c285fc93-2f58-4acb-b9e3-083caa86d366...oglegroups.com...
Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
Also EXEC is a SQL*Plus command not a PL/SQL one.

Regards
Michel




Reply With Quote
  #9  
Old   
Michel Cadot
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 10:37 AM




"Kevin S" <SearleK (AT) googlemail (DOT) com> a écrit dans le message de news:
c285fc93-2f58-4acb-b9e3-083caa86d366...oglegroups.com...
Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
v_dbms_stats VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => ''LOAD'',
estimate_percent => 100, cascade => TRUE,options => ''GATHER
AUTO'');';
BEGIN
EXECUTE IMMEDIATE v_dbms_stats;
END;


ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
Also EXEC is a SQL*Plus command not a PL/SQL one.

Regards
Michel




Reply With Quote
  #10  
Old   
ddf
 
Posts: n/a

Default Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS - 10-31-2008 , 11:52 AM



On Oct 31, 6:53*am, Kevin S <Sear... (AT) googlemail (DOT) com> wrote:
Quote:
When I run the block below, in oracle 10.2.0.3.0, I get the error
shown after. Is this a problem with my coding or is it just not
possible to run this commad in pl/sql?

Thanks

DECLARE
* * v_dbms_stats * *VARCHAR2(200):= 'EXEC
DBMS_STATS.GATHER_SCHEMA_STATS( ownname *=> ''LOAD'',
estimate_percent => 100, cascade => *TRUE,options => ''GATHER
AUTO'');';
BEGIN
* *EXECUTE IMMEDIATE *v_dbms_stats;
END;

ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 4
Why are you using EXECUTE IMMEDIATE to run a PL/SQL packaged procedure
from within PL/SQL when this works:

BEGIN
DBMS_STATS.GATHER_SCHEMA_STATS( ownname => 'LOAD',
estimate_percent => 100, cascade => TRUE,options => 'GATHER AUTO');
END;
/

Can you enlighten us as to why you think this exercise is absolutely
necessary?


David Fitzjarrell


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.