0

I get the SQL error ORA-00933 for the statement below. This parses in postgres, but not in oracle... How should this be formatted for oracle?

Thanks in advance!

UPDATE comments 
SET parent_type='report' 
FROM reports 
WHERE comments.parent_id=reports.id;
2
  • Please check the manual, the syntax is documented there: docs.oracle.com/cd/E11882_01/server.112/e26088/… Commented Feb 2, 2013 at 6:13
  • ORACLE doesn't supports FROM for the UPDATE queries. Commented Feb 2, 2013 at 23:42

1 Answer 1

4

Try this for Oracle:

UPDATE Comments
SET parent_type = 'report'
WHERE parent_id IN (SELECT Id FROM Reports)

Or if you're trying to set the value equal to a value in another column:

UPDATE Comments
SET parent_type = (SELECT FieldName
                   FROM reports
                   WHERE reports.id = Comments.parent_id);

This would work with MSSQL:

UPDATE c
SET c.parent_type='report' 
FROM Comments c JOIN reports r ON c.parent_id=r.id

Good luck.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.