Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Execute Immediate and Cursors

RE: Execute Immediate and Cursors

From: Melanie Caffrey <melanie_caffrey_at_yahoo.com>
Date: Mon, 14 Jun 2004 16:21:42 -0700 (PDT)
Message-ID: <20040614232142.45687.qmail@web51908.mail.yahoo.com>


OK.

He can still use a ref cursor with native dynamic sql.

No need for the execute immediate verb, though.

CREATE OR REPLACE PROCEDURE get_my_cursor

                        (p_column IN  <your choice>,
                         p_table IN  <your choice>,
                         p_predicate IN <your choice>,
                         p_jobid  IN  dept.jobid%TYPE,
                         p_cursor OUT SYS_REFCURSOR)

sql_stmt VARCHAR2(1000);
job_rec dept%ROWTYPE;

BEGIN sql_stmt := 'SELECT job_name, :c

               FROM :t
              WHERE :w > :j';

 OPEN p_cursor FOR sql_stmt

    USING p_column, p_table, p_predicate, p_jobid;  LOOP
    FETCH p_cursor INTO job_rec;
    EXIT WHEN p_cursor%NOTFOUND;

    .
    .
    .

 END LOOP;
 CLOSE p_cursor;

END;


Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Mon Jun 14 2004 - 18:18:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US