Home » SQL & PL/SQL » SQL & PL/SQL » How to order data table data on update?
icon8.gif  How to order data table data on update? [message #223848] Mon, 12 March 2007 01:38 Go to next message
Ranjanabh
Messages: 2
Registered: March 2007
Junior Member
Hi,

I have requirement such that when I'm inserting data in my table I would want the data to be sorted after the insert. For ex.

DATA
----
A
C

After inserting entry B and retrieving the data, it should appear as

DATA
----
A
B
C

I dont want to include the 'order by' clause. Is there some way that a trigger can be written which re orders the data of a table on insert.

Any suggestions are welcome.

Thanks
Ranjanabh
Re: How to order data table data on update? [message #223850 is a reply to message #223848] Mon, 12 March 2007 01:47 Go to previous messageGo to next message
martijn
Messages: 286
Registered: December 2006
Location: Netherlands
Senior Member
As far as I know there is no easy way in predicting in which order oracle stores the data, and in which way it returns it by a select statement.

May I know why you don't want to use a "order by" clause?
Re: How to order data table data on update? [message #223870 is a reply to message #223850] Mon, 12 March 2007 02:54 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Martijn is right.
Unless you use an Index Organized Table (or IOT), data is not stored in any order inside a table. You order it when you select your data.
Re: How to order data table data on update? [message #223908 is a reply to message #223848] Mon, 12 March 2007 04:34 Go to previous messageGo to next message
Ranjanabh
Messages: 2
Registered: March 2007
Junior Member
Thanks for the inputs guys.

Basically what happens is that I have an VC++ application which is making use of a table. Now what happens is that when my application is fetching the data it more or less executes a

"SELECT [COL1],[COL1],....[COLN] FROM TABLE"

but due to some restriction i cant add the order by clause.

Thanks once again you guys!
Re: How to order data table data on update? [message #223909 is a reply to message #223908] Mon, 12 March 2007 04:38 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
What strange restrictions are those?
Previous Topic: attendance table
Next Topic: Newbie Query
Goto Forum:
  


Current Time: Fri Dec 06 01:43:25 CST 2024