Hello all,
I am working on some triggers to help keep up with Adds/Deletes/Updates, our business requires that we send data loads out to people, and an initial file, followed by an adds/deletes/updates file makes the most sense (as we will only have to send 4+ gig files only once, then can send much smaller 30meg or so files later on). Anyway, here are the triggers, that I am working on, but I keep getting an error stating that the table does not exist...
Trigger Code:
For some reason, it seems like most of the problems are with understanding what the v$session table is. Strangely, I can query from it in SQL*plus, but the trigger doesn't recognize it.
Any ideas?
Thanks in advance,
Kevin
- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.
I am working on some triggers to help keep up with Adds/Deletes/Updates, our business requires that we send data loads out to people, and an initial file, followed by an adds/deletes/updates file makes the most sense (as we will only have to send 4+ gig files only once, then can send much smaller 30meg or so files later on). Anyway, here are the triggers, that I am working on, but I keep getting an error stating that the table does not exist...
Trigger Code:
Code:
CREATE OR REPLACE TRIGGER LOG_UPDATES
BEFORE UPDATE of LAST_NAME ON MY_TABLE
REFERENCING old AS pre new AS post
DECLARE
var_OS_USER VARCHAR2(50);
for each row
BEGIN
SELECT osuser
INTO var_OS_USER
FROM v$session
WHERE audsid=userenv('sessionid');
if (post.LAST_NAME != pre.LAST_NAME)
then
INSERT INTO CHANGELOG
VALUES(pre.PK_UNIQUE_ID, sysdate, var_OS_USER,'LAST_NAME', post.LAST_NAME, pre.LAST_NAME);
end if
END;
CREATE OR REPLACE TRIGGER LOG_ADDS
BEFORE INSERT ON MY_TABLE
DECLARE
var_OS_USER VARCHAR2(50);
BEGIN
SELECT osuser
INTO var_OS_USER
FROM v$session
WHERE audsid=userenv('sessionid');
INSERT INTO ADDLOG
VALUES(new.PK_UNIQUE_ID, sysdate, var_OS_USER);
END;
CREATE OR REPLACE TRIGGER LOG_DELETES
BEFORE DELETE ON MY_TABLE
DECLARE
var_OS_USER VARCHAR2(50);
BEGIN
SELECT osuser
INTO var_OS_USER
FROM v$session
WHERE audsid=userenv('sessionid');
INSERT INTO DELLOG
VALUES(old.PK_UNIQUE_ID, sysdate, var_OS_USER);
END;
For some reason, it seems like most of the problems are with understanding what the v$session table is. Strangely, I can query from it in SQL*plus, but the trigger doesn't recognize it.
Any ideas?
Thanks in advance,
Kevin
- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.