Subject Re: [firebird-support] ORDER BY with INSERT/UPDATE/DELETE
Author Almond
At 00:12 03/12/06 +0100, you wrote:
>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

Use:

Delete from table where primary_key > '0' ;

Look's shorter.

>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
>
>
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/