Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Oracle Ref Cursors as a PB datawindow source

97 views
Skip to first unread message

lharris

unread,
Oct 8, 2003, 11:34:18 AM10/8/03
to
I am currently trying to find a way to create dynamic sql within my
package procedure and then pass the resulting cursor created by this
sql back out to my datawindow; however, I am getting an error on the
open of the cursor within the procedure. Here is the basic idea of
what I'm trying to do within the stored procedure:

PROCEDURE CM_FIND_DUP_PAYMENTS
(li_pk IN number,
li_source_fk IN number,
li_payee IN varchar2,
li_payee_fk IN number,
li_trans_date IN varchar2,
li_amt IN number,
li_trans_type IN varchar2,
lo_result_set IN OUT PAYMENT_CURSOR)
AS
query varchar2(4000);

BEGIN
/*build cusor*/
query := 'SELECT cm_transaction_pk, source_record_fk,
source_table_name,
query := query || ' FROM cm_transaction t, claim c, occurrence o,
class_action
query := query || ' WHERE t.source_record_fk = c.claim_pk(+) AND
query := query || ' AND t.cm_batch_fk = b.cm_batch_pk(+) AND
IF li_pk > 0 THEN
query := query || ' AND t.cm_transaction_pk = '|| li_pk ||' ';
END IF;

/*open cusor*/
OPEN lo_result_set FOR query;

END CM_FIND_DUP_PAYMENTS;


At the "OPEN" statement, the following error occurs when compiling:
PLS-00455: CURSOR 'lo_result_set' cannot be used in dynamic sql
statement

0 new messages