title: Error PLS-00103 compiling user-defined function in Oracle
body: <p>I'm trying to create a user defined function in Oracle that will return a DATE when given a text argument containing a date substring.  I've tried a couple ways of writing this, and all seem to throw the same error:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION lm_date_convert (lm_date_in IN VARCHAR2(50))
    RETURN DATE DETERMINISTIC IS
  BEGIN
    RETURN(TO_DATE(REGEXP_REPLACE(lm_date_in, '([[:digit:]]{2})[-/.]*([[:digit:]]{2})[-/.]*([[:digit:]]{4})','\3-\1-\2'), 'YYYY-MM-DD'));
  END;
  </code></pre>
  
  <p>the error:</p>
  
  <blockquote>
    <p>FUNCTION lm_date_convert Compiled. 1/46<br>
    PLS-00103: Encountered
    the symbol "(" when expecting one of
    the following:</p>
    
    <p>:= . ) , @ % default character The
    symbol ":=" was substituted for "(" to
    continue.</p>
  </blockquote>
  
  <p>Any thoughts on this, and general UDF writing tips (and good references) are welcome!  Thanks.</p>