title: Oracle Pl/SQl: custom function with intermediate results
body: <p>I need to transform a string into a number using some oracle built-in methods (parsing, strlength, ...)<br>
  I don't know how to assign a value to a variable inside the method, and I don't know where to put the declare section.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION EXAMPLE (param IN VARCHAR2) 
  RETURN NUMBER AS
  BEGIN
  
    SELECT &lt;string_handling_using_param&gt; 
      INTO var 
      FROM DUAL;
  
    RETURN TO_NUMBER(&lt;some computation using var&gt;);
  
  END EXAMPLE ;
  </code></pre>
  
  <p>I have tried some variation around this function, like adding an OUT parameter for storing the intermediate var, but then I can not call the function from regular SQL...</p>
  
  <p>Any suggestion on how to achieve this ?</p>