Amaia Espinosa
Amaia Espinosa

Reputation: 23

SQL UPDATE - INNER JOIN QUERY

I am trying to do an update in 2 tables, but i have this error:

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

Could you help me please? The query is:

UPDATE a
SET a.ACTORID_ = SUBSTR(a.ACTORID_, 2, LENGTH(a.ACTORID_)),
    b.TASKACTORID_ = SUBSTR(b.TASKACTORID_, 2, LENGTH(b.TASKACTORID_))
FROM jbpm_taskinstance AS a
    INNER JOIN jbpm_log AS b 
    ON b.TASKACTORID_ = a.ACTORID_
WHERE a.ACTORID_ = b.TASKACTORID_
     AND b.TASKINSTANCE_ IN (
          SELECT ID_ 
          FROM jbpm_taskinstance 
          WHERE a.PROCINST_ =b.PROCINST_)
     AND b.TASKACTORID_ = a.ACTORID_;

Upvotes: 0

Views: 134

Answers (1)

wolφi
wolφi

Reputation: 8361

Welcome to the world of strange and misleading Oracle error messages!

With experience, you can spot the error by sight, as @a_horse_with_no_name has done.

If you don't see the error immediately, I'd recommend to make the query simpler step by step until the error disappears. In your case, I would remove the AND b.taskinstance_ IN () subquery and check if the same error comes up. Then I'd remove the SUBSTR with a simple constant, like SET a.ACTORID_ = 'a'. Then I'd remove the JOIN, updating only table A. This will run ok, so you need to read up Oracle's documentation on UPDATE.

Upvotes: 1

Related Questions