oracle存储过程生成编译错误

时间:2013-11-18 16:45:32

标签: oracle stored-procedures oracle10g

这是一个简单的过程,它生成了ORA -24344编译错误和PLS - 00103.请帮助清除它们

create or replace PROCEDURE test (v_price in number)
IS
BEGIN 
    if ROWNUM = 0
        insert into admin (price) values (v_price);
    else 
        update admin set price = v_price; 
    end if;
END;

1 个答案:

答案 0 :(得分:1)

在条件之后忘了then

create or replace PROCEDURE test (v_price in number) IS
rn number;
BEGIN
  select count(*) into rn from admin;
  if rn = 0 THEN
    insert into admin (price) values (v_price);
  else
    update admin set price = v_price;
  end if;
END;