create table aaa as
select
t1.tabname
,t2.colname
,row_number() over (order by t1.tabname ) as rn
from
systables t1
inner join
syscolumns t2
on
t1.tabid = t2.tabid
and
t1.tabid >= 100
and
t2.colname='active'
create procedure "gbaseuser".alter_active() returns varchar(200);
define re varchar(200);
define tab_name varchar(200);
define sqls varchar(200);
define cishu int;
define i int;
select count(*) into cishu from aaa;
let i = 1;
loop
if i > cishu then
exit;
else
select tabname into tab_name from aaa where rn=i;
let sqls = ' update '|| tab_name ||' set active =1 ' ;
execute immediate sqls;
end if;
let i = i + 1;
end loop;
select 'over' into re from dual;
RETURN re;
end procedure
;