1

Topic: The trigger of dens

Created the table of dens and  the trigger on DML,

MY.CHANGED_BY: = USER;
MY.CHANGED_TIME: = SYSDATE;

Are normally added and how to register that a title  too it was added that is the terminal?

SELECT TERMINAL FROM SYS.AUD $

2

Re: The trigger of dens

Goofy122 wrote:

Created the table of dens and  the trigger on DML,

MY.CHANGED_BY: = USER;
MY.CHANGED_TIME: = SYSDATE;

Are normally added and how to register that a title  too it was added that is the terminal?

SELECT TERMINAL FROM SYS.AUD $

Or IP the user

3

Re: The trigger of dens

Goofy122;
SYS_CONTEXT/USERENV

4

Re: The trigger of dens

123 wrote:

Goofy122;
SYS_CONTEXT/USERENV

CREATE TABLE DEPT$AUDIT (
DEPTNO NUMBER;
DNAME VARCHAR2 (14 byte);
LOC VARCHAR2 (13 byte);
CHANGE_TYPE VARCHAR2 (1 byte);
CHANGED_BY VARCHAR2 (30 byte);
TERMINAL VARCHAR2 (50);
CHANGED_TIME DATE
);
SELECT * FROM DEPT$AUDIT;
CREATE OR REPLACE TRIGGER AUDITDEPTAR AFTER
INSERT OR UPDATE OR DELETE ON DEPT FOR EACH ROW
DECLARE
MY DEPT$AUDIT%ROWTYPE;
BEGIN
IF INSERTING THEN MY.CHANGE_TYPE: = ' I ';
ELSIF UPDATING THEN MY.CHANGE_TYPE: = ' U ';
ELSE MY.CHANGE_TYPE: = ' D ';
END IF;
MY.CHANGED_BY: = USER;
MY.CHANGED_TIME: = SYSDATE;
MY.TERMINAL: = SYS_CONTEXT/USERENV;
CASE MY.CHANGE_TYPE
WHEN ' I ' THEN
MY.DEPTNO: =:NEW.DEPTNO;
MY.DNAME: =:NEW.DNAME;
MY.LOC: =:NEW.LOC;
ELSE
MY.DEPTNO: =:OLD.DEPTNO;
MY.DNAME: =:OLD.DNAME;
MY.LOC: =:OLD.LOC;
END CASE;
INSERT INTO DEPT$AUDIT VALUES MY;
END;
[Error] PLS-00306 (29: 23): PLS-00306: wrong number or types of arguments in call to ' SYS_CONTEXT'

Where an error help please

5

Re: The trigger of dens

0 wrote:

Goofy122,

select SYS_CONTEXT (' USERENV ', ' IP_ADDRESS') from DUAL;

Thanks