Create Or Replace Trigger CUX_PAY_ARCHPAYROLL_TRG
Before insert on pay_payroll_actions
FOR EACH ROW
DECLARE
v_payroll_id pay_payroll_actions.PAYROLL_ID%TYPE;
BEGIN
select max(payroll_id) into v_payroll_id from pay_payrolls;
:NEW.PAYROLL_ID := v_payroll_id;
END;