Clicky

Dear fellow developers:

I have the following SQL query that I am trying to execute:

 "DELETE from OWNER where OWNER.ID = USER.UID, OWNER.NUM = USER.NUM, OWNER.DATE = USER.DATE"                             
1: 

Select allOpen in new window


However, when I execute this code from C#, I am getting the error:

ORA-00933: SQL command not properly ended

I have two tables, OWNER, and USER.  Can anyone see what I am doing wrong?

Thanks in advance to all who reply.

asked 12/15/2011 02:35

fsyed's gravatar image

fsyed ♦♦


7 Answers:
     

DELETE O
from OWNER O
join USER U
  on O.ID = U.UID
 and O.NUM = U.NUM
 and O.DATE = U.DATE
link

answered

knightEknight's gravatar image

knightEknight

No commas in a select and delete:

"DELETE from OWNER where OWNER.ID = USER.UID AND OWNER.NUM = USER.NUM AND OWNER.DATE = USER.DATE"

That said, where is USER coming from?  As is, it is still not valid.
link

answered 2011-12-15 at 10:38:50

slightwv's gravatar image

slightwv

where is USER defined?
link

answered 2011-12-15 at 10:39:31

sdstuber's gravatar image

sdstuber

>>DELETE O from OWNER O join USER U

I'm not sure Oracle allows this syntax.
link

answered 2011-12-15 at 10:40:10

slightwv's gravatar image

slightwv

DELETE from OWNER where
(id, owner, date) IN (SELECT uid, num,date FROM USER);


 
link

answered 2011-12-15 at 10:40:51

schwertner's gravatar image

schwertner

delete owner where exists (select null from user where OWNER.ID = USER.UID and OWNER.NUM = USER.NUM and OWNER.DATE = USER.DATE)
link

answered 2011-12-15 at 10:42:49

sdstuber's gravatar image

sdstuber

Thanks very much for your prompt replies.  With your help, I realized what my errors were, and I was able to figure out my mistake.  My query become much bigger, because I had to include some additional clauses, but thank to you guys, I was able to get the ball rolling.
link

answered 2011-12-15 at 10:45:48

fsyed's gravatar image

fsyed

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×156
×51
×17
×132

Asked: 12/15/2011 02:35

Seen: 313 times

Last updated: 12/15/2011 04:21