前天遇到一个在pl/sql 执行truncate的问题,不能直接写
truncate table 。。。
查询发现如下连接:
http://orafaq.com/faqplsql.htm
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).来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-82950/ ,如需转载,请注明出处,否则将追究法律责任。