Not with execute immediate. Use dbms_sql
I have done this.

For example and help 
http://asktom.oracle.com/pls/ask/f?p=4950:8:104566430235951855::NO::F495
0_P8_DISPLAYID,F4950_P8_CRITERIA:584023239495,

Regards,
 
Kamaljeet Singh (NCDB ASG)
MBT, 52 Barrack Square, Martlesham. IP5 3RF.
Off. 01473 667170
Mob. 077 5368 5370
[EMAIL PROTECTED]
  

-----Original Message-----
[EMAIL PROTECTED]
Sent: 11 March 2003 16:29
To: Multiple recipients of list ORACLE-L

g_colName is a string of column names that I build earlier in the
algorithm. My problem is how do I do the 'INTO' part of this cursor,
since I do not know how many or of what type my columns are. The query
is on the fly and totally dynamic.

Anyway to do this without using DBMS_SQL package?   

OPEN cur_values FOR 'SELECT '||g_colName ||
                            ' FROM ' || p_sourceSchema||'.'||v_tableName
||
                            ' WHERE PARENT_RESOURCE_ID BETWEEM :1 AND
:2'

                          USING p_startResourceID, p_endResourceID;
                          LOOP
                            FETCH cur_values
                             INTO v_values;
                          EXIT WHEN cur_values%NOTFOUND;

                  EXECUTE IMMEDIATE 'INSERT INTO
'||p_targetSchema||'.'||v_tableName||
                                    '('||g_colName||')'||
                                    '(VALUES)';

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: <[EMAIL PROTECTED]
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************

Visit us at http://www.mahindrabt.com


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Kamaljeet  Singh
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to