Execute Immediate

From: The Magnet <art_at_unsu.com>
Date: Sun, 20 Sep 2009 11:15:05 -0700 (PDT)
Message-ID: <eaac5471-2237-414f-b97e-68ab4cc4d118_at_j9g2000vbp.googlegroups.com>


Hi,

I am still working on this one. I have a dynamic statement that looks like this:

EXECUTE IMMEDIATE 'SELECT count(*) FROM customers_lookup WHERE customer_id = :customer_id' INTO v_data USING v_customer_id;

That works great, but the actual statement looks more like this:

EXECUTE IMMEDIATE 'SELECT count(*) FROM ' || v_table_name || ' WHERE customer_id = :customer_id ' INTO v_data USING v_customer_id;

No matter how hard I play with this and the quotes and such, it seems to not like the fact that I'm putting the statement together in pieces and complains that CUSTOMER_ID bind variable is not defined. I've played with a number of quote combinations also with no luck.

I'm still playing with it, but maybe someone else can help me reach the answer faster.

Many thanks! Received on Sun Sep 20 2009 - 13:15:05 CDT

Original text of this message