I started out with this code,
This worked as a trigger but it did not store the user id.
I added some code to it,
This caused major issues with the system.
I am just trying to caputure the user id and store it, does anybody have any ideas?
Code:
CREATE OR REPLACE TRIGGER PROCURE."LAWSON_PRICE_CHG_TRG"
AFTER UPDATE OF "BASE_COST"
ON "LAWSON"."POVAGRMTLN"
REFERENCING NEW AS N OLD AS O
FOR EACH ROW
BEGIN
IF ( NOT (:O.BASE_COST = :N.BASE_COST))
THEN
INSERT into PROCURE.PRICE_CHG_LOG
(procure_group, ven_agrmt_ref, item, base_cost_old, base_cost_new, user_id, effective_dt)
values
(:o.procure_group, :o.ven_agrmt_ref, :o.item, :o.base_cost, :n.base_cost, sys.login_user, sysdate);
END IF;
END;
This worked as a trigger but it did not store the user id.
I added some code to it,
Code:
CREATE OR REPLACE TRIGGER PROCURE."LAWSON_PRICE_CHG_TRG"
AFTER UPDATE OF "BASE_COST"
ON "LAWSON"."POVAGRMTLN"
REFERENCING NEW AS N OLD AS O
FOR EACH ROW
DECLARE
myuser varchar2(30);
BEGIN
SELECT osuser
into myuser
from sys.v_$session;
IF ( NOT (:O.BASE_COST = :N.BASE_COST))
THEN
INSERT into PROCURE.PRICE_CHG_LOG
(procure_group, ven_agrmt_ref, item, base_cost_old, base_cost_new, user_id, effective_dt)
values
(:o.procure_group, :o.ven_agrmt_ref, :o.item, :o.base_cost, :n.base_cost, myuser, sysdate);
END IF;
END;
This caused major issues with the system.
I am just trying to caputure the user id and store it, does anybody have any ideas?