Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2012
    Posts
    15

    Red face Unanswered: SQL Error: ORA-00933: SQL command not properly ended

    Hi All,
    I am trying to update a record in oracle SQL developer by using Joins.
    Following is my query-

    UPDATE system_info set field_value = 'NewValue'
    FROM system_users users JOIN system_info info
    ON users.role_type = info.field_desc
    where users.user_name = 'uname'
    However, when I tried to execute it, I got following error-
    Error report:
    SQL Error: ORA-00933: SQL command not properly ended
    00933. 00000 - "SQL command not properly ended"
    Tried many solutions but not helped.
    can anybody tell me the error reason and solution

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Oracle does not support JOINing in an UPDATE statement (which is clearly documented in the manual)

    You need to replace that with a (corelated) sub-select

  3. #3
    Join Date
    Jan 2012
    Posts
    15

    SQL Error: ORA-00933: SQL command not properly ended

    I tried removing JOINS
    now my query looks like
    UPDATE system_info info SET info.field_value = 'NewValue'
    FROM system_users users
    where users.user_name = 'uname' AND users.role_type = info.field_desc
    but still having same error

  4. #4
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Again: you need to replace that with a (corelated) sub-select.

    If you had looked at the manual, you would have seen that FROM is also not supported by Oracle - which is more or less self-evident if JOINs are not supported.

  5. #5
    Join Date
    Jan 2012
    Posts
    15

    Cool SQL Error: ORA-00933: SQL command not properly ended


    Thanks shammat,
    u were right.

    I added the sub query, and it worked like a charm..
    I have modified the query in following way-

    UPDATE system_info info SET info.field_value = 'NewValue'
    WHERE info.field_desc = (SELECT users.role_type FROM system_users WHERE user_name = 'uname')
    Now it is working absolutely fine.
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •