Wednesday, October 31, 2012

Update Oracle SQL Query throwing missing right parenthesis error

You can't have an order by clause in a subquery, if you think about it there is no point having one as you don't need to influence the order of an update. If you remove the order by your query should work and the outcome would be no different to if the order by were allowed.

UPDATE  mytable
SET     node_index = 0
WHERE   rowid IN
        (
        SELECT  rid
        FROM    (
                SELECT  rowid AS rid
                FROM    mytable
                WHERE   procs_dt IS NOT NULL
                ORDER BY
                        cret_dt, prty
                )
        WHERE   rownum <= 10
        )
 
http://stackoverflow.com/questions/6764497/update-oracle-sql-query-throwing-missing-right-parenthesis-error 

No comments:

Post a Comment