ITPub博客

首页 > Linux操作系统 > Linux操作系统 > execute immediate 语法小结

execute immediate 语法小结

原创 Linux操作系统 作者:regonly1 时间:2010-01-04 17:19:58 0 删除 编辑


execute immediate 语法小结
查询语句:
单条记录:
execute immediate
'select a.dummy from dual' into v_dummy;

多条记录:
execute immediate
'select dbms_random.value(0,1) from dual connect by rownum <= 10'
bulk collect into v_dummy;

使用绑定变量:
execute immediate
'select dbms_random.value(0,1) from dual connect by rownum <= :1'
bulk collect into v_dummy
using rowcnt;

更新语句:
更新并获取单个所更新记录:
execute immediate
'update test t set t.flag = 1 where t.id = 10 returning t.name into :1'
returning into v_name;

更新并获取多个所更新记录:
execute immediate
'update test t set t.flag = 1 where t.name like ''jack%'' returning t.name into :1'
returning bulk collect into v_names;
delete和insert 语句与update基本类似。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12932950/viewspace-624250/,如需转载,请注明出处,否则将追究法律责任。

上一篇: V$SQL_BIND_DATA
请登录后发表评论 登录
全部评论

注册时间:2008-05-10

  • 博文量
    257
  • 访问量
    1073625