Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Triggers fails to compile. Why?
Hi!
When I try to compile the trigger below, I get the error message:
PLS-00201: identifier 'SYS.V_$SESSION' must be declared
Why???? v$session is nothing but a synonym for v$_session. The user trying to compile this trigger has DBA privileges.
CREATE OR REPLACE TRIGGER TBREVENUECAT_TRIGGER_DEL AFTER DELETE
ON VIVOUSER.TBREVENUECAT
FOR EACH ROW
BEGIN
DECLARE myApplName varchar2(50);
BEGIN
SELECT PROGRAM into myApplName FROM v$session WHERE audsid = userenv('sessionid'); IF Trim(Upper(myApplName))<>Trim('VIVOCLIENT.EXE') THEN INSERT INTO OM_TBREVENUECAT (OM_TRANSID, OM_TRANSTYPE, OM_TRANSSTATUS, COMPANYID, STORELOCID, REVCATID, DEPTID, STATUS) VALUES (OM_IDS.NextVal, 'D', 'N', :OLD.COMPANYID, :OLD.STORELOCID, :OLD.REVCATID, :OLD.DEPTID, :OLD.STATUS); END IF;