I want to be able to get teh sequence value and use the same value on several operations in a trigger to do an audit operation for a table. So when a table is updated, I want to get all the column that were updated. But I want to have them grouped as one when I register the changed column in the database. Is there a way to get a sequence number and store in a variable inside a trigger. The code that I was able to make keeps on getting PLS-00357.
CREATE OR REPLACE TRIGGER TRG_EMPLOYEE_CHANGED AFTER INSERT OR DELETE
OR UPDATE ON EMPLOYEE REFERENCING OLD AS old NEW AS new FOR EACH ROW
DECLARE
GROUPID NUMBER := SEQ_POPERATIONLOG_LOGSUBNO.NEXTVAL;
BEGIN
OPERATION('FIRST_NAME', GROUPID, :old.FIRST_NAME, :new.FIRST_NAME);
OPERATION('LAST_NAME', GROUPID, :old.LAST_NAME, :new.LAST_NAME);
OPERATION('ADDRESS', GROUPID, :old.ADDRESS, :new.ADDRESS);
OPERATION('TELEPHONE', GROUPID, :old.TELEPHONE, :new.TELEPHONE);
END;
I think I got the answer by using select into.