前天遇到一个在pl/sql 执行truncate的问题,不能直接写
truncate table 。。。
查询发现如下连接:
http://orafaq.com/faqplsql.htm
Can one call DDL statements from PL/SQL?
begin EXECUTE IMMEDIATE 'CREATE TABLE X(A DATE)'; end;
NOTE: The DDL statement in quotes should not be terminated with a semicolon.
EXECUTE IMMEDIATE 'TRUNCATE TABLE ...' ;
One can call DDL statements like CREATE, DROP, TRUNCATE, etc. from PL/SQL by using the "EXECUTE IMMEDATE" statement. Users running Oracle versions below 8i can look at the DBMS_SQL package (see FAQ about Dynamic SQL).