ERROR IS: ORA-01007: variable not in select list

From: Sudhir <>
Date: Mon, 1 Feb 2010 16:13:30 -0800 (PST)
Message-ID: <>

I have a cursor inside a procedure which fetches some records using dynamic query.
Now I need to insert these values into a table long with two more values, one is a unique ID and the other is testcase name. Unique ID- It can be anything. In this case I use a variable J and increment it by 1 each time when I fetch the record. Test case name will be a static value that comes as a IN parameter of SP.


insert into tableA
(snum,firstname,lastname,status,add1,add2,addcity,addstate,addzip,tcnum,order_ID) values (

o_sban.sNUM ,
o_sban.FIRSTNAME ,
o_sban.LASTNAME ,
o_sban.STATUS ,
o_sban.sADDRADDR1 ,
o_sban.sADDRADDR2 ,
o_sban.sADDRCITY ,
o_sban.sADDRSTATE ,
o_sban.sADDRZIP ,

tcnum ,
) ;


end loop;

The script used to work without any issue when the column in select statement was equal to column in the table. Since I need those two values, I added it in the table and modified the script accordingly. The datatype are same in both select statement and table.
When I ran the script I started getting "ERROR IS: ORA-01007: variable not in select list".
Can anyone help me on this?
I appreciate your help... Received on Mon Feb 01 2010 - 18:13:30 CST

Original text of this message