javi@psi.ernet.in (javeed anwar t) wrote:
>
>Friends,
>
>I am facing a problem related to locking in INFORMIX SE 5.1.
>When I DECLARE a CURSOR FOR UPDATE using ORDER BY, at the time of
>opening, the Error is -365. This prevents me from using ORDER BY
>with UPDATE CURSOR. Pls explain some way to get out of this
>problem.
>
>Javeed
>
Well,
this is a feature - not a bug. It simply is not possible to use
an ORDER BY-Clause in an Update-Cursor. This has to do with
locking problems.
For short: If you are declaring a update-cursor, the server puts
U-locks on the read pages(rows). If you are using Order by, the
server creates temporary tables for doing the sort (in most
cases); therefore it's of no use the put locks (and afterwards do
the update) on the temp-table.
This is why each cursor creating a temp-table cannot be an
update-cursor. Temp-tables are created for ORDER BY, DISTINCT,
GROUP BY and UNION.
Peter