首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

存储过程动态实施SQL

2012-08-07 
存储过程动态执行SQLCREATE OR REPLACE PROCEDURE KM.UPDATE_INST_META_PRO ??? is???? cursor cur is

存储过程动态执行SQL

CREATE OR REPLACE PROCEDURE "KM"."UPDATE_INST_META_PRO"
??? is
???? cursor cur is select * from recovery_inst_currmeta where flag = 0 and rownum < 1000;
???? str varchar2(1024);
begin
??????? dbms_output.put_line('Begin...');
??????? for item in cur loop
????????? begin
???????????? str:='' || item.update_sql || '';
???????????? dbms_output.put_line('finished: ' || str);
???????????? EXECUTE IMMEDIATE str;
???????????? update recovery_inst_currmeta set flag = 1 where update_sql = item.update_sql;
???????????? commit;
????????? end;
??????? end loop;
??????? dbms_output.put_line('End!');
? end;
/

热点排行