DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: PLS-00405: subquery not allowed in this context

  1. #1
    Join Date
    Sep 2006
    Posts
    114

    PLS-00405: subquery not allowed in this context

    Dear All,

    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
    BEFORE INSERT
    ON terminusbill.sdr_tblsswcdrs
    FOR EACH ROW
    DECLARE
    elementid NUMBER (10):= 2;
    BEGIN

    IF :NEW.ssw_duration > 0
    AND :NEW.SSW_IC_CarrierID) Not IN (SELECT UPPER(TRUNKID) FROM NE_TRUNKSFORSUBREPORTS )


    THEN
    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)
    );
    END IF;
    END IF;

    /

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width