Re: using EXECUTE IMMEDIATE to run DBMS_STATS.GATHER_SCHEMA_STATS

From: gym dot scuba dot kennedy at gmail <kennedyii_at_verizon.net>
Date: Fri, 31 Oct 2008 14:26:10 GMT
Message-ID: <6AEOk.1655$Jv2.854@nwrddc01.gnilink.net>

"Kevin S" <SearleK_at_googlemail.com> wrote in message news:c285fc93-2f58-4acb-b9e3-083caa86d366_at_w39g2000prb.googlegroups.com...
> 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 Received on Fri Oct 31 2008 - 09:26:10 CDT

Original text of this message