create procedure test
as
num number;
begin
select count(1) into num from table1;
if num=0 then
insert into table1 values(...);
commit;
update table2 set col_name=(select value from table1 where table2.col_id=table1.col_id);
if sql%rowcount=0 then
insert into table2 values(...);
end if;
else
if 条件1 then
update table1 set col_name=....;
else
select count(1) into num from table2 where exists(select 1 from table1 where col_id=table2.col_id;
if num>0 then
update table2 set col_name=value;
if sql%rowcount=0 then
insert into table2 values(...);
end if;
end if;
end if;
end;
/
as
num number;
begin
select count(1) into num from table1;
if num=0 then
insert into table1 values(...);
commit;
update table2 set col_name=(select value from table1 where table2.col_id=table1.col_id);
if sql%rowcount=0 then
insert into table2 values(...);
end if;
else
if 条件1 then
update table1 set col_name=....;
else
select count(1) into num from table2 where exists(select 1 from table1 where col_id=table2.col_id;
if num>0 then
update table2 set col_name=value;
if sql%rowcount=0 then
insert into table2 values(...);
end if;
end if;
end if;
end;
/
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货