11.1 execute immudiate

Posted sannyhome

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了11.1 execute immudiate相关的知识,希望对你有一定的参考价值。

 

用法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的值为> < = 

以上是关于11.1 execute immudiate的主要内容,如果未能解决你的问题,请参考以下文章

Following executables are active : /lib/libclntsh.so.11.1

Flink解决 No ExecutorFactory found to execute the application

MySQL如何将变量插入到表中

Xcode 11.1 错误:产生多个命令

DirectX 11.1 和 Win32 桌面

GCC online documentation | 更新至11.1