plsql help: dynamic cursor
From: <flaggedatbest_at_yahoo.com>
Date: Fri, 15 Sep 2000 13:36:14 GMT
Message-ID: <8pt8kc$n5k$1_at_nnrp1.deja.com>
Date: Fri, 15 Sep 2000 13:36:14 GMT
Message-ID: <8pt8kc$n5k$1_at_nnrp1.deja.com>
Hi,
[Quoted] I'm trying to do this:
TYPE cur_type IS REF CURSOR;
my_cursor cur_type;
my_sql VARCHAR(2000) := 'select col_1, col_2, col_n, from '||v_table||'
where col_a = :var_a AND col_b = :var_b';
....
OPEN my_cursor FOR my_sql USING (var1, var2);
FETCH my_cursor INTO (dat1, dat2, datn) LOOP
....
Oracle complains "Encountered my_sql when expecting select"
I won't know the where condition variables or the table name until run-time so they have to be dynamic. I think this is the only way to accomplish this. Also, this may return many rows.
Any ideas on how to get this to work? Many thanks in advance!
-Dan
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Sep 15 2000 - 15:36:14 CEST