title: Case statements in PL/SQL functions
body: <p>I'm running into the error trying to compile a function.</p>
  
  <blockquote>
    <p>PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL
    statement only</p>
  </blockquote>
  
  <p>Here is the Function.</p>
  
  <pre><code> create or replace function get_ulq (
      i_vcust_cd IN VARCHAR2,
      i_vordr_type IN VARCHAR2,
      i_vpart_no IN VARCHAR2
    ) RETURN VARCHAR2 
    AS
      ulq_count varchar2(50 char) := null; 
    BEGIN 
      CASE WHEN exists ( SELECT count(*)
                           FROM P1.p7ulqpm0
                          WHERE cust_cd = i_vcust_cd
                            AND src     = i_vordr_type
                            AND part_no = i_vpart_no)
          then  select ulq 
                  into ulq_count
                 from p1.p2partm0
                where src = i_vordr_type
                  and part_no = i_vpart_no;
          ELSE ulq_count := 1;
      END CASE;
      RETURN ulq_count;
    END get_ulq;
  </code></pre>