Bind Variable with Dynamic SQL
Posted on 2003-03-03
I have the following procedure that tries to fill a table with the cursor data.
CREATE OR REPLACE PROCEDURE qup_cc_payment_table(
id VARCHAR2) IS
TYPE cur_typ IS REF CURSOR;
query_str := 'SELECT payment_date, payment_amount FROM ' || appeal ||
'.pledge_payment ' ||
'WHERE id_number = :' || id;
DELETE FROM qut_cc_temp_plg_payments;
OPEN c FOR query_str USING id;
FETCH c INTO payment_date, payment_amount;
EXIT WHEN c%NOTFOUND;
INSERT INTO qut_cc_temp_plg_payments(
It keeps giving me the error of a bind variable being "invalid" or "does not exist" and I don't quite understand this. I just started looking at this dynamic SQL today. Any help will be greatly appreciated.