Home » SQL & PL/SQL » SQL & PL/SQL » insert into
insert into [message #210333] Wed, 20 December 2006 07:07 Go to next message
webadministrator
Messages: 45
Registered: October 2005
Member
hello,

i want to insert values to a field called ( comment ) in a table called ( group ) only when code_Comm is = 6
this is what i wrote:

insert when ( code_Comm = 6 )
then
into group (comment)
values('good')

its giving me the following error: ORA - 00925: missing INTO keyword.

what am i doing wrong?
thank you in advance.
Re: insert into [message #210337 is a reply to message #210333] Wed, 20 December 2006 07:18 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
insert into group (comment)
values('good')
where code_Comm = 6


MHE
Re: insert into [message #210340 is a reply to message #210333] Wed, 20 December 2006 07:34 Go to previous messageGo to next message
webadministrator
Messages: 45
Registered: October 2005
Member
i tries this one.
its giving me: SQL command not properly ended..
Re: insert into [message #210341 is a reply to message #210340] Wed, 20 December 2006 07:38 Go to previous messageGo to next message
joy_division
Messages: 4642
Registered: February 2005
Location: East Coast USA
Senior Member
GROUP and COMMENT are invalid names for Oracle objects, unless you used double quotes when creating them and every time you want to reference them. Bad idea.
Re: insert into [message #210343 is a reply to message #210333] Wed, 20 December 2006 07:43 Go to previous message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
hello,
it seems to me you do not want to insert new rows to the table, just update one column based on values of another column. Something like
update "group" set "comment" = 'good' where code_comm = 6;
If not, where will you get the code_comm value from?
It was not a good idea to name your table and column with Oracle keyword. Have to put it into doublequotes when accessing it.
Previous Topic: SQL Oddity
Next Topic: redirecting result of a sql query in a file in shell scripting
Goto Forum:
  


Current Time: Wed Dec 07 16:41:27 CST 2016

Total time taken to generate the page: 0.08458 seconds