Home » SQL & PL/SQL » SQL & PL/SQL » Column not allowed here
icon5.gif  Column not allowed here [message #276483] Thu, 25 October 2007 04:56 Go to next message
khresmoi
Messages: 24
Registered: October 2007
Junior Member

I'm trying to insert a record into a table inside a cursor loop.

FOR REC IN CUR_MAST2
INSERT INTO xyz (a,s,d,f,POST_DATE,c_NAME,INSTANCE_NAME)
VALUES (SEQ_S_ID.NEXT_VAL,'AS','TAB'||lv_partition_name,
'DRP'||lv_partition_name,SYSDATE,REC.T_NAME,lv_UI_name);

'DRP'||lv_partition_name,SYSDATE,REC.T_NAME,lv_UI_name);
*
ERROR at line 3:
ORA-00984: column not allowed here

if i hardcode value for lv_UI_name, i get the same error with '*' under REC.T_NAME. Sad But as far as i've seen and read, i CAN use a variable or a value from cursor-fetched record here. Confused

Help!!

TIA..
Re: Column not allowed here [message #276486 is a reply to message #276483] Thu, 25 October 2007 05:03 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Hi
can you post your actual code, as the above code would give you a different error. Also encase the code in code tags ( [code] [/code] to preserve formatting.
Re: Column not allowed here [message #276500 is a reply to message #276483] Thu, 25 October 2007 06:05 Go to previous messageGo to next message
khresmoi
Messages: 24
Registered: October 2007
Junior Member
the entire code is too big to post.
That is the line which gives out the error and the same error.. in the VALUES clause, wherever i'm using a variable, i get this error.
Re: Column not allowed here [message #276502 is a reply to message #276483] Thu, 25 October 2007 06:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Why not just insert select without any cursor?

Regards
Michel
Re: Column not allowed here [message #276544 is a reply to message #276483] Thu, 25 October 2007 08:13 Go to previous messageGo to next message
khresmoi
Messages: 24
Registered: October 2007
Junior Member
didn't quite get ur Q....

Anyway, i absolutely need to use the cursor due to the design of the main program.
this particular error - ORA-00984: column not allowed here - is generlly encountered when u use column names in the VALUES clause. but in my peice of code i'm not using any column names.
i'm looking for the other probable causes of error. or any pointers as to why this error was encountered.
Re: Column not allowed here [message #276547 is a reply to message #276544] Thu, 25 October 2007 08:18 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Maybe you're using IM speak for Oracle keywords and columns instead of the full name.
Re: Column not allowed here [message #276554 is a reply to message #276544] Thu, 25 October 2007 08:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:

didn't quite get ur Q....

This shut me up.

Regards
Michel
Re: Column not allowed here [message #276557 is a reply to message #276547] Thu, 25 October 2007 08:43 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
... or you could look up the usage of a sequence. What are the pseudocolumns one can use with an index? CURRVAL and ???.

Very Happy

MHE

[Edit]And don't even think about replying me in IM speak! Use plain English or don't bother.

[Updated on: Thu, 25 October 2007 08:44]

Report message to a moderator

Previous Topic: select query
Next Topic: SQL Join
Goto Forum:
  


Current Time: Tue Dec 10 02:01:07 CST 2024