标签:span from where declare cut TE var hang ntp
用法1:立刻执行sql语句
v_sql := ‘insert into tt‘;
execute immediate v_sql;
用法2:立刻执行sql语句,并赋值给某个变量
v_sql := ‘select count(1) from student‘;
execute immediate v_sql into v_num;
这是为了举例,实际直接’select count(1) intp v_num from student’ 就可以.
用法3:带参数的sql
v_sql:=‘select * from student t where t.name=:1 and t.age=:2‘;
execute immediate v_sql using ‘ZhangSan‘,23;
使用execute immudiate 为了拼接sql语句的情况:
Declare
v_l1 varchar2(255);
v_l2 varchar2(255);
Select compare,qty into v_l1,v_l2 from a;
Execute immudiate ‘select * from a1 where a1’||v_l1||’v_l2’
--compare的值为> < =
标签:span from where declare cut TE var hang ntp
原文地址:https://www.cnblogs.com/sannyhome/p/9212596.html