0

I am having trouble deleting from multiple tables.
I am using the code below to delete from multiple tables:

DELETE
FROM usession,
  upklist,
  projshar USING usession
LEFT JOIN upklist
ON upklist.session_id = usession.session_id
LEFT JOIN Projshar
ON projshar.session_id = usession.session_id
WHERE usession.session_id       = 
  (SELECT session_id
  FROM USESSION
  WHERE delete_session_id IS NULL
  AND user_id              =
    (SELECT user_id FROM users WHERE regexp_like(USER_NAME, 'gfcashmo', 'i')
    )
  );

I am using sql developer connection to an oracle database and get the following error which references the second line - FROM usession,

Error at Command Line:274 Column:13 Error report: SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 - "SQL command not properly ended" *Cause:
*Action:

duplode
  • 33,731
  • 7
  • 79
  • 150
user3662630
  • 41
  • 1
  • 1
  • 2
  • 1
    I don't think Oracle supports deleting from multiple tables in one statement. You can read about Oracle's delete here: http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_8005.htm#i2112830. – Gordon Linoff May 21 '14 at 21:44
  • 1
    You can't delete from mult tables in one statement. May be you confusing with deleting from single table using selects and joins – T.S. May 21 '14 at 21:50
  • What happens if you replace `DELETE` with `SELECT *` and execute that? – Bob Jarvis - Слава Україні May 22 '14 at 01:36
  • possible duplicate of [Delete with "Join" in Oracle sql Query](http://stackoverflow.com/questions/12672082/delete-with-join-in-oracle-sql-query) – Jon Heller May 22 '14 at 02:51

1 Answers1

0

According to ducumentation of DELETE statement Oracle has no support for deleting from multiple tables.

TOP KEK
  • 2,593
  • 5
  • 36
  • 62