title: Parallel Execution of Procedures in SQL Statement (Oracle 11g)
body: <p>I have a SQL-Statement which uses a <code>Check-Function</code> which takes a quite long time for execution.</p>
  
  <p>Now I want to Parallize the execution of the <code>Check-Function</code>, but it does not work.</p>
  
  <p>Where is the mistake I made?</p>
  
  <p>The sample below takes 5 Seconds to execute, but for my understanding it should take about 1 Second because of the parallelism. </p>
  
  <p>Code Snippet for Testing:</p>
  
  <pre><code>CREATE TABLE PERSON AS
  SELECT LEVEL AS ID, 'Person_'||LEVEL AS NAME
  FROM DUAL 
  CONNECT BY LEVEL &lt;= 5;
  
  CREATE OR REPLACE FUNCTION LONGCHECKFUNC(ID NUMBER)
  RETURN NUMBER IS
  BEGIN
      --Doing some very heavy Checks....
      DBMS_LOCK.SLEEP(1 /*second*/);
      RETURN 1;
  END;
  
  SELECT /*+PARALLEL(person, 5) */ *
   FROM PERSON
  WHERE LONGCHECKFUNC(ID)=1;
  </code></pre>