Re: Order of rows in temp tables
Posted in 1998
Martin,
I talked to Informix about this last year, I was using v7.20 and they
said that the order of data can not be guaranteed in a temp table. You
should always do the order by when presenting data from the temp
table.
Regards
David Ashby
______________________________ Reply Separator _________________________________
Subject: Order of rows in temp tables
Author: <martin.brassard1@sympatico.ca; MBrassard@magrit.com> at WCA-INET
Date: 14/6/98 8:11 PM
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 intotemp 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.
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