Need help correcting a SQL statement for Oracle

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"

Open 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.
fsyedAsked:
Who is Participating?
 
slightwv (䄆 Netminder) Commented:
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.
0
 
knightEknightCommented:
     

DELETE O
from OWNER O
join USER U
  on O.ID = U.UID
 and O.NUM = U.NUM
 and O.DATE = U.DATE
0
 
sdstuberCommented:
where is USER defined?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
slightwv (䄆 Netminder) Commented:
>>DELETE O from OWNER O join USER U

I'm not sure Oracle allows this syntax.
0
 
schwertnerCommented:
DELETE from OWNER where
(id, owner, date) IN (SELECT uid, num,date FROM USER);


 
0
 
sdstuberCommented:
delete owner where exists (select null from user where OWNER.ID = USER.UID and OWNER.NUM = USER.NUM and OWNER.DATE = USER.DATE)
0
 
fsyedAuthor Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.