create sequence s_npdes_WATERBODY increment by 1 start with 1 nocache; create or replace trigger WATERBODY_BEFORE_INSUPDT BEFORE INSERT OR UPDATE ON NPDES.WATERBODY FOR EACH ROW DECLARE v_Id Number; v_Count Number; BEGIN :new.Updated_By := USER; :new.Last_Update := SYSDATE; IF :new.KeyID Is Null or :new.KeyID < 1 THEN select s_npdes_WATERBODY.nextval into v_Id from dual; :new.KeyID := v_Id; END IF; END; /If you have users connecting to Oracle using their own user ID, you have to grant them SELECT privileges on any sequences. You also need to create public synonyms for all the table names and sequence names.