SOURCE
create or replace TRIGGER st_messages
BEFORE INSERT ON messages
FOR EACH ROW
BEGIN
SELECT s_messages.nextval
INTO :new.p_id
FROM dual;
END;