declare
v_sql varchar2(5000);
begin
v_sql:='select * from emp';
execute immediate v_sql;
v_sql varchar2(5000);
begin
v_sql:='select * from emp';
execute immediate v_sql;
end;
在PLSQL语句块中不能执行动态拼接而成的DDL和DCL语句。但是可以 execute immediate 来执行动态拼接而成的sql语句。