#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    1
    Rep Power
    0

    Exclamation Using While Exists


    Hello Guys,

    Please help me on my code. I am encountering error in this code.

    WHILE EXISTS ( SELECT * FROM tblOrgChart WHERE fxOrgID = v_chrTempKeyDept )
    LOOP
    v_intDept := CAST(v_chrTempKeyDept AS NUMBER) + 1 ;
    v_chrTempKeyDept := LPAD('',3 - LENGTH(CAST(v_intDept AS VARCHAR2)),'0') || CAST(v_intDept AS VARCHAR2) ;
    END LOOP;


    Error: PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement only

    Please help me,
    Thanks
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    854
    Rep Power
    387
    Originally Posted by ohmarlontoc
    Hello Guys,

    Please help me on my code. I am encountering error in this code.

    WHILE EXISTS ( SELECT * FROM tblOrgChart WHERE fxOrgID = v_chrTempKeyDept )
    LOOP
    v_intDept := CAST(v_chrTempKeyDept AS NUMBER) + 1 ;
    v_chrTempKeyDept := LPAD('',3 - LENGTH(CAST(v_intDept AS VARCHAR2)),'0') || CAST(v_intDept AS VARCHAR2) ;
    END LOOP;


    Error: PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement only

    Please help me,
    Thanks
    Perhaps because "WHILE EXISTS" is not a valid PL/SQL statement?

    You should Read The Fine Manual : "OracleŽ Database PL/SQL Language Reference "

IMN logo majestic logo threadwatch logo seochat tools logo