Re: Order of rows in temp tables
Posted in 1998
In article <35842CFB.6B1B@sympatico.ca>, Martin Brassard <martin.brassar
d1@sympatico.ca> writes
>Hi,
>
>We have made a little experiment with temp tables and would appreciate
>that someone confirme the results.
>
>Let's say we have TableA (ColA Integer, ColB Char(10), ColC smallint);
>
>We issue the folowing query:
>
>Select ColA, ColB from TableA where ColC = 2 order by ColA, ColB into>temp TempA;
>
>Here whe have in TempA the subset of TableA that should be ordered by
>ColA & ColB.
>
>Then we issue that other query:
>
>Select ColA, ColB from TempA;>or
>Select ColA, ColB from TempA where ColA >= 100;>
>In these cases, the rows from TempA are returned ordered by ColA & ColB,
>even if we don`t specify the order by clause, probably because of the
>physical order of the data in TempA.
>
>My question is : Can we assume that the rows of the temp table will
>always be returned in the physical order of the table if we don`t
>spedify an order by clause in our query.
>
No, without an order by the ordering is UNDEFINED..
^^^^^^^^^
^^^^^^^^^
>What makes me hesitate to implement this is that I think that the clause
>"order by" with "into temp" was a invalid syntax in earlier version of
>Informix.
>
>Thanks,
>
>Martin
--
David Williams
Maintainer of the Informix FAQ
Primary site (Beta Version) http://www.smooth1.demon.co.uk
Official site http://www.iiug.org/techinfo/faq/faq_top.html
I see you standin', Standin' on your own, It's such a lonely place for you, For
you to be If you need a shoulder, Or if you need a friend, I'll be here
standing, Until the bitter end...
So don't chastise me Or think I, I mean you harm...
All I ever wanted Was for you To know that I care