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
Also EXEC is a SQL*Plus command not a PL/SQL one.
Regards
Michel
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
If you do want to call a PL/SQL procedure dynamically (although I
can't see why you would want to here) it would need to be 'CALL' and
not the SQL*Plus command 'EXEC', or else enclose it within a
'BEGIN...END;' block (including the PL/SQL semicolon not required by
the SQL 'CALL').