SQL> desc t_sql;
Name Type Nullable Default Comments
---- -------------- -------- ------- --------
A INTEGER Y
B VARCHAR2(4000) Y
Name Type Nullable Default Comments
---- -------------- -------- ------- --------
A INTEGER Y
B VARCHAR2(4000) Y
SQL> select * from t_sql;
A B
--------------------------------------- --------------------------------------------------------------------------------
1 select 1 from dual
2 select 2 from dual
SQL> insert into t_sql values(3,'select sysdate from dual');
1 row inserted
SQL> commit;
Commit complete
ed
SQL> ed proc_t_sql;
SQL>
SQL> create or replace procedure proc_t_sql(in_a int)
2 as
3 v_b varchar2(4000);
4 v_s varchar2(4000);
5 begin
6 select b into v_b from t_sql where a=in_a;
7 execute immediate v_b into v_s;
8 dbms_output.put_line(v_s);
9 end;
10 /
Procedure created
SQL> exec proc_t_sql(3);
2013-01-28
PL/SQL procedure successfully completed
SQL>
A B
--------------------------------------- --------------------------------------------------------------------------------
1 select 1 from dual
2 select 2 from dual
SQL> insert into t_sql values(3,'select sysdate from dual');
1 row inserted
SQL> commit;
Commit complete
ed
SQL> ed proc_t_sql;
SQL>
SQL> create or replace procedure proc_t_sql(in_a int)
2 as
3 v_b varchar2(4000);
4 v_s varchar2(4000);
5 begin
6 select b into v_b from t_sql where a=in_a;
7 execute immediate v_b into v_s;
8 dbms_output.put_line(v_s);
9 end;
10 /
Procedure created
SQL> exec proc_t_sql(3);
2013-01-28
PL/SQL procedure successfully completed
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-753421/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-753421/