How can I use "FOR UPDATE" with a JOIN on Oracle?

Posted by tangens on Stack Overflow See other posts from Stack Overflow or by tangens
Published on 2010-04-06T15:19:22Z Indexed on 2010/04/06 15:23 UTC
Read the original article Hit count: 245

Filed under:
|
|
|

The answer to another SO question was to use this SQL query:

SELECT o.Id, o.attrib1, o.attrib2 FROM table1 o
JOIN (
  SELECT DISTINCT Id FROM table1, table2, table3 WHERE ...
) T1
ON o.id = T1.Id

Now I wonder how I can use this statement together with the keyword FOR UPDATE. If I simply append it to the query, Oracle will tell me:

ORA-02014: cannot select FOR UPDATE from view

Do I have to modify the query or is there a trick to do this with Oracle? With MySql the statement works fine.

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about join