Subject | ORDER BY with INSERT/UPDATE/DELETE |
---|---|
Author | Christian Danner |
Post date | 2003-12-05T23:12:37Z |
Hi all,
is there a reason why INSERT/UPDATE/DELETE don't support a specific
ordering in accordance with the SELECT statement?
At first sight this question might look strange. In the end the job is
done - basta.
But imagine a table with LIFO stored rows, where triggers watch over
this business rule of an I/O in chronological order.
To clear the table
DELETE FROM TABLE
would raise an exception, whereas a loop like
FOR SELECT TABLE.ID
FROM TABLE
ORDER BY TABLE.TIMSTAMP DESC
INTO :T_ID
DO
DELETE
FROM TABLE
WHERE TABLE.ID = :T_ID
would be way too slow.
Why not
DELETE FROM TABLE
ORDER BY TABLE.TIMSTAMP DESC ?
Is it to be SQL-92/99 compliant?
Regards,
Christian
is there a reason why INSERT/UPDATE/DELETE don't support a specific
ordering in accordance with the SELECT statement?
At first sight this question might look strange. In the end the job is
done - basta.
But imagine a table with LIFO stored rows, where triggers watch over
this business rule of an I/O in chronological order.
To clear the table
DELETE FROM TABLE
would raise an exception, whereas a loop like
FOR SELECT TABLE.ID
FROM TABLE
ORDER BY TABLE.TIMSTAMP DESC
INTO :T_ID
DO
DELETE
FROM TABLE
WHERE TABLE.ID = :T_ID
would be way too slow.
Why not
DELETE FROM TABLE
ORDER BY TABLE.TIMSTAMP DESC ?
Is it to be SQL-92/99 compliant?
Regards,
Christian