一碗白开水*

导航

存储过程

循环从表中 sql 语句,执行sql语句获取值,插入表中

create or replace procedure inserttest as
cursor cs is SELECT objid,DATA_COUNT_SQL FROM sys_count;
objid varchar(128);
DATA_COUNT_SQL varchar(500);
v_sql varchar(500);
v_num varchar(500);
begin
for c in cs loop
BEGIN
v_sql:=c.data_count_sql;
execute immediate v_sql into v_num;
update sys_count set data_count=v_num where objid=c.objid;
commit;
END;
end loop;
end inserttest;

posted on 2017-11-07 16:59  一碗白开水*  阅读(76)  评论(0编辑  收藏  举报