Home » RDBMS Server » Server Administration » Regarding order by
Regarding order by [message #59663] Mon, 15 December 2003 02:06 Go to next message
GIRIDHAR KODAKALLA
Messages: 92
Registered: May 2001
Member
Hi,
suppose i have a table EMP,which is loaded only thru the script.
I load the data from a data file using sql*loader.
I dont have any real time updates,deletes or inserts.
at a given point of time i am giving an sql statement as :
select * from emp order by empno,sal;
(My order by is not on primary key columns,just 2 columns).

After some time,i truncate the table and load the same data
again.If i execute the same query,will oracle return data
in the same order. If the data is not changed at all,
can i be assured that the given data be always in the same order?

Thanks in advance.
Giridhar
Re: Regarding order by [message #59666 is a reply to message #59663] Mon, 15 December 2003 03:18 Go to previous messageGo to next message
dilip kumar
Messages: 111
Registered: December 2003
Senior Member
hi

As long as ur not performing any DML's oracle will ensure that, but if u perform dml and b.cos of this a row migration occurs then it can't ensure u the order of data.

if u wann order of data then you can go for index organization tables but there are few complications if that table primary is to be disabled/dropped
Re: Regarding order by [message #59669 is a reply to message #59663] Mon, 15 December 2003 04:17 Go to previous message
Thiru
Messages: 1089
Registered: May 2002
Senior Member
Not sure if I completely understood your question,but when you ORDER BY EMPNO,SAL , the result set is sorted in that order , irrespective of any changes. The data itself might change,if there is any DML, but the order itself is determined at run time by your query. On the flip side, even if there is no DML, in the absence of the order by clause, the rows 'may or may not' be returned in the same order as before.

-Thiru
Previous Topic: 'clean' temporary tablespace in 9i
Next Topic: Temp Tablespace not being flushed automatically
Goto Forum:
  


Current Time: Fri Sep 20 08:21:41 CDT 2024