存储过程里if判断问题

2025-03-24 07:58:22
推荐回答(1个)
回答1:

create or replace procedure zhuancunis is

  p_cnt number;

begin

  select count(1) into p_cnt from test2;

  if p_cnt > 0 then

    delete from test2;

  end if;

  select count(1) into p_cnt from test4;

  if p_cnt > 0 then

    delete from test4;

  end if;

  insert into test2

    select * from test1;

  insert into test4

    select * from test3;

  commit;

end;