Oracle
 sql >> Database >  >> RDS >> Oracle

Posso usare IF in PL/SQL?

CREATE OR REPLACE TRIGGER whole_number_trigger 
  BEFORE INSERT 
  ON abc FOR EACH ROW
  BEGIN
  SELECT 'Board_' || whole_seq.nextval INTO :new.whole_number FROM dual;
  IF :new.board = 'guide' THEN 
    SELECT guide_seq.nextval INTO :new.board_number FROM dual;
  ELSIF   :new.board = 'notify' THEN 
    SELECT notify_seq.nextval INTO :new.board_number FROM dual;
  END IF;
END;  
/