title: Can i use REGEXP_LIKE as a condition with IF in a PL/SQL block
body: <p>I'm trying to create a function designed to traverse a tree of organisational units filtering out some based on their level in the tree structure and weather they appear on our intranet page. The input to the function is the ORG_UNIT_ID of the starting unit, a flag to show if we should care about the intranet flag and a comma separated list of levels. For instance '2,3'. I'm trying to use REGEXP_LIKE in conjunction with an ELSEIF inside a loop to run up the tree until I hit the first eligible parent unit.</p>
  
  <p>T_STOP is the control variable for the loop. R_ORG_UNIT_OVER is used to query meta-data on the above unit. During the loops first pass this will be the unit above the one passed as input to the function.</p>
  
  <p>The cursor definition:</p>
  
  <pre><code>CURSOR C_ORG_UNIT_OVER(V_ORG_UNIT_ID ORG_UNIT.ORG_UNIT_ID%TYPE) IS
    SELECT  ORUI.ORG_UNIT_ID
    ,       ORUI.ORG_LEVEL
    ,       ORUI.SHOW_ON_INTRANET
  FROM    ORG_UNIT ORUI
  JOIN    ORG_UNIT_PARENT OUPA ON ORUI.ORG_UNIT_ID=OUPA.ORG_UNIT_ID_PARENT
  WHERE   OUPA.ORG_UNIT_ID = V_ORG_UNIT_ID;
  </code></pre>
  
  <p>The failing code segment in the loop:</p>
  
  <pre><code>IF R_ORG_UNIT_OVER.SHOW_ON_INTRANET = 'N' THEN
    T_ORG_UNIT_ID := R_ORG_UNIT_OVER.ORG_UNIT_ID;
  ELSEIF REGEXP_LIKE (P_SKIP_LEVEL, '(^|,)' || R_ORG_UNIT_OVER.ORG_LEVEL || '($|,)') THEN
    T_ORG_UNIT_ID := R_ORG_UNIT_OVER.ORG_UNIT_ID;
  ELSE
    T_STOP := 'Y';
  END IF;
  </code></pre>
  
  <p>However this code always throws a PLS-00103 error on the REGEXP_LIKE symbol. Is there some sort of limitation or alternate way in which REGEXP_LIKE works when used as a condition in a PL/SQL IF/ELSEIF block as opposed to in a regular query?</p>