1 can one call DDL statement from PL/SQL?
one can call DDL statements like Create,DROP,Truncate ,etc from PL/SQL by using the "EXECUTE IMMEDIATE" statement examples
DECLARE
var VARCHAR2(100);
BEGIN
var := 'CREATE TABLE temp1(col1 NUMBER(2))';
EXECUTE IMMEDIATE var;
END;
NOTE: The DDL statement in quotes should not be terminated with a semicolon.
Users running Oracle versions below Oracle 8i can look at the DBMS_SQL package (see FAQ about Dynamic SQL).
one can call DDL statements like Create,DROP,Truncate ,etc from PL/SQL by using the "EXECUTE IMMEDIATE" statement examples
DECLARE
var VARCHAR2(100);
BEGIN
var := 'CREATE TABLE temp1(col1 NUMBER(2))';
EXECUTE IMMEDIATE var;
END;
NOTE: The DDL statement in quotes should not be terminated with a semicolon.
Users running Oracle versions below Oracle 8i can look at the DBMS_SQL package (see FAQ about Dynamic SQL).
使用PL/SQL执行DDL语句:CREATE、DROP、TRUNCATE等
本文详细介绍了如何通过PL/SQL的EXECUTE IMMEDIATE语句来执行DDL操作,如创建、删除、截断表等。对于运行在Oracle版本8以下的用户,提供了使用DBMS_SQL包的方法。
181

被折叠的 条评论
为什么被折叠?



