Home » SQL & PL/SQL » SQL & PL/SQL » Syntax error (10 g)
Syntax error [message #569241] Tue, 23 October 2012 09:42 Go to next message
musclebreast
Messages: 24
Registered: July 2012
Junior Member
Hi, I struggle with an insert statement.


INSERT INTO Table (NID, NType) SELECT DTreeNotifySequence.NextVal, 1 FROM Dee WHERE ID =354344 commit;




I get the following error:

ORA-00933: SQL command not properly ended 



I tried it in several ways...are more semicolons needed? I couldn't find a similar example so I hope you have a hint for me?

Kind regards,

Lara
Re: Syntax error [message #569242 is a reply to message #569241] Tue, 23 October 2012 10:29 Go to previous messageGo to next message
Luke.M
Messages: 9
Registered: October 2012
Location: UK
Junior Member
error in the WHERE clause.
should be no space between ID and =

WHERE ID=354344
Re: Syntax error [message #569245 is a reply to message #569242] Tue, 23 October 2012 11:06 Go to previous messageGo to next message
Barbara Boehmer
Messages: 7930
Registered: November 2002
Location: California, USA
Senior Member
With Oracle, it makes no difference if there is a space before and/or after the = or not. The error is that you are missing a semicolon after the insert statement, before the commit. It should be like below.

INSERT INTO Table (NID, NType) SELECT DTreeNotifySequence.NextVal, 1 FROM Dee WHERE ID =354344;
commit;
Re: Syntax error [message #569252 is a reply to message #569245] Tue, 23 October 2012 12:54 Go to previous messageGo to next message
Luke.M
Messages: 9
Registered: October 2012
Location: UK
Junior Member
Oh... sorry, still learning. That's why I registered. I'm told in Basic SQL it does matter, but Oracle reads it differently...
I thought it might have been a missing semicolon there but I wanted to check with my own mentor before posting that... you beat me to it Razz

[Updated on: Tue, 23 October 2012 13:09]

Report message to a moderator

Re: Syntax error [message #569276 is a reply to message #569252] Wed, 24 October 2012 01:29 Go to previous message
Michel Cadot
Messages: 58480
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
There is not only a missing ";" but also a missing line feed.
Oracle (SQL*Plus) does not accept several SQL statements on a line:
SQL> insert into t (total) values (0); commit;
insert into t (total) values (0); commit
                                *
ERROR at line 1:
ORA-00911: invalid character

Regards
Michel
Previous Topic: Newbie SELECT WHERE DATE
Next Topic: To_Date()
Goto Forum:
  


Current Time: Tue Jul 22 04:57:25 CDT 2014

Total time taken to generate the page: 0.16653 seconds