title: Why can't I call my function in a SQL statement?
body: <p>I create a package that executes my function in a SELECT statement right inside that same page:</p>
  
  <pre><code>CREATE OR REPLACE PACKAGE p
     AUTHID DEFINER
  IS
     FUNCTION f
        RETURN NUMBER;
  END;
  /
  
  CREATE OR REPLACE PACKAGE BODY p
  IS
     FUNCTION ff RETURN NUMBER
     IS
     BEGIN
        RETURN 73;
     END;
  
     FUNCTION f RETURN NUMBER
     IS
        l_number   NUMBER;
     BEGIN
        SELECT 42 INTO l_number
          FROM DUAL
         WHERE ff () = 73;
  
        RETURN l_number;
     END;
  END;
  /
  
  BEGIN
     DBMS_OUTPUT.put_line (p.f);
  END;
  /
  </code></pre>
  
  <p>But when I try to execute that function, I get the PLS-00231 compile error:</p>
  
  <pre><code>BEGIN
     dbms_output.put_line (P.F);
  END;
  /
  
  PLS-00231: function 'FF' may not be used in SQL
  </code></pre>
  
  <p>The function is declared right there. It doesn't execute any non-query DML. It doesn't have any PL/SQL-specific datatypes in the header. </p>
  
  <p>Why can't SQL use/see it?</p>