title: Executing a procedure in oracle with multiple cursors as output
body: <p>How to execute a procedure having multiple cursors as output in oracle.</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE TC_OWNER.usp_GetGEGAllDataBySecurityID(
  p_SecurityID NUMBER,
  cur1 OUT sys_refcursor,
  cur2 OUT sys_refcursor,
  cur3 OUT sys_refcursor,
  cur4 OUT sys_refcursor,
  cur5 OUT sys_refcursor)
  AS 
  
  v_EffectiveDate TIMESTAMP(3);
  v_CompanyID NUMBER(10);
  BEGIN
  
  SELECT MAX(EffectiveStartDate) INTO v_EffectiveDate
  FROM    tblGEGSecurityDtls
  WHERE    SecurityId = p_SecurityID AND SYSDATE BETWEEN EffectiveStartDate 
  and EffectiveEndDate;
  
  
  SELECT  CompanyID INTO v_CompanyID
  FROM    tblGEGSecurityDtls
  WHERE    SecurityId = p_SecurityID AND EffectiveStartDate = 
  v_EffectiveDate;
  
  usp_GetGEGSecurityDtls(p_SecurityID,cur1);
  usp_GetGEGRecommendations(p_SecurityID,cur2);
  usp_GetGEGCompanyDtls(v_CompanyID,cur3);
  usp_GetGEGSectorRegionData(v_CompanyID,null,cur4);
  usp_GetGEGCompanyDivisionData(v_CompanyID,null,cur5);
  
  END;
  </code></pre>
  
  <p>Here anything starting with usp_ denotes a procedure.
  Each of the procedure returns a table.</p>
  
  <p>The same can easily be achieved in sql but i am unable to execute this in oracle.</p>
  
  <p>Edit : As per the answer given by vc74 i tried the below code to print all the five tables but it is throwing error:</p>
  
  <pre><code>declare
  lcur1 sys_refcursor;
  lcur2 sys_refcursor; 
  lcur3 sys_refcursor; 
  lcur4 sys_refcursor; 
  lcur5 sys_refcursor; 
  begin
  usp_GetGEGAllDataBySecurityID(
      p_SecurityID =&gt; 457, 
      cur1 =&gt; lcur1, 
      cur2 =&gt; lcur2,
      cur3 =&gt; lcur3,
      cur4 =&gt; lcur4,
      cur5 =&gt; lcur5
  );
  end;
  print lcur1;
  print lcur2;
  print lcur3;
  print lcur4;
  print lcur5;
  </code></pre>
  
  <p>How to print all the tables in the output window?</p>