title: Oracle, calling PL/SQL issues from within SQL-Plus file x.sql says my_function "may not be a function"
body: <p>so simple, if I create my function as <code>CREATE OR REPLACE FUNCTION MD5_ENCODE</code> it will run smoothly, but if it stays anonymously within the SQL-Plus block as PL/SQL --> "may not be a function" error.</p>
  
  <p>What is this Oracle "feature" again?</p>
  
  <pre><code>DECLARE
  
  FUNCTION MD5_ENCODE(CLEARTEXT IN VARCHAR2) RETURN VARCHAR2 IS    
      CHK VARCHAR2(16);   
      HEX VARCHAR2(32);  
      I   INTEGER;  
      C   INTEGER;  
      H   INTEGER;  
  BEGIN
      IF CLEARTEXT IS NULL THEN
          RETURN '';
      ELSE
          CHK := DBMS_OBFUSCATION_TOOLKIT.MD5(INPUT_STRING
  =&gt; CLEARTEXT);
          FOR I IN 1 .. 16 LOOP
              C := ASCII(SUBSTR(CHK, I, 1));
              H := TRUNC(C / 16);
              IF H &gt;= 10 THEN
                  HEX := HEX || CHR(H + 55);
              ELSE
                  HEX := HEX || CHR(H + 48);
              END IF;
              H := MOD(C, 16);
              IF H &gt;= 10 THEN
                  HEX := HEX || CHR(H + 55);
              ELSE
                  HEX := HEX || CHR(H + 48);
              END IF;
          END LOOP;  
          RETURN HEX;  
      END IF;  
  
  END;  
  
  BEGIN  
      UPDATE ADDRESSES_T SET STREET = MD5ENCODE(STREET) ;  
  
  -- etc...  
  END   
  </code></pre>