PLS-00405: subquery not allowed in this context
i am trying to create the following trigger but got the error "PLS-00405: subquery not allowed in this context"
can anybody help me in this regard?
CREATE OR REPLACE TRIGGER trg_sdr_tblsswcdrs
FOR EACH ROW
elementid NUMBER (10):= 2;
IF :NEW.ssw_duration > 0
AND :NEW.SSW_IC_CarrierID) Not IN (SELECT UPPER(TRUNKID) FROM NE_TRUNKSFORSUBREPORTS )
INSERT INTO sdr_tblsubmissedcdrs
(smcr_rawcdrid, pc_parsedcode, pe_errorcode,
smcr_callingnumber, smcr_callednumber, ne_elementid,
smcr_calltime, ct_calltypeid, smcr_voiceusageduration
VALUES (:NEW.ssw_voicerecordid, 0, 0,
:NEW.ssw_txcallingnum, :NEW.ssw_txcallednum, 2,
:NEW.ssw_disconntime, 0, CEIL (:NEW.ssw_duration / 10)
Subqueries are only allowed in SQL statements which is not your case -IF
You may want to rewrite your trigger in a way your IF statement is asking for a condition set in between BEGIN and IF statements.
Pablo (Paul) Berzukov
Author of Understanding Database Administration
available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Click Here to Expand Forum to Full Width