Krish
Krish

Reputation: 13

oracle stored procedure generates an compliation error

This is a simple procedure and it generated a ORA -24344 compilation error and PLS - 00103. Please help in clearing them

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;

Upvotes: 0

Views: 157

Answers (1)

Rémi Svahn
Rémi Svahn

Reputation: 123

You forgot then after the condition :

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;

Upvotes: 1

Related Questions