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;
/