create or replace TRIGGER st_relations BEFORE INSERT ON relations FOR EACH ROW BEGIN SELECT s_relations.nextval INTO :new.p_id FROM dual; END;