ITPub博客

首页 > 数据库 > Oracle > oracle 执行动态SQL的另外一个妙招,execute immediate 的旧版本替代

oracle 执行动态SQL的另外一个妙招,execute immediate 的旧版本替代

原创 Oracle 作者:littledan 时间:2007-03-11 18:04:11 0 删除 编辑

让我们看看老版本的oracle 是怎么执行动态SQL的

create or replace procedure scheam1.trunc*** as

source_cursor integer;

rows_processed integer;

native constant integer := 1;

begin
source_cursor := dbms_sql.open_cursor;
dbms_sql.parse(source_cursor,
'truncate table ****** reuse storage',
native);
rows_processed := dbms_sql.execute(source_cursor);
commit;
dbms_sql.close_cursor(source_cursor);
exception
when others then
if dbms_sql.is_open(source_cursor) then
dbms_sql.close_cursor(source_cursor);
end if;
raise;
end;

[@more@]

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

请登录后发表评论 登录
全部评论

注册时间:2008-01-13

  • 博文量
    31
  • 访问量
    137718