‎2008 Jan 26 4:51 AM
hi everyone:
I want to sort the database talbe record.in native sql statements,what statement I
can use.can sort statement work?
thanks a lot
‎2008 Jan 26 4:52 AM
Please check SELECT with ORDER BY option
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a53358411d1829f0000e829fbfe/content.htm
a®s
Edited by: a®s on Jan 26, 2008 12:01 AM
‎2008 Jan 26 5:03 AM
I only want to sort the database record,not fetch data,no matter how ,I will try your idea,thanks
‎2008 Jan 26 5:07 AM
database sort is done by system by primary key , if you want to sort the database records other than primary key then you need to use for secondary index.
a®
‎2008 Jan 26 5:18 AM
hi
I have created a secondary index,but the result is the same as the old version,
I think native sql will be helpful,but i donot know what should i do? my background
datasystem is oracle
‎2008 Jan 26 5:28 AM
Please check this thread
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm
a®
‎2008 Mar 13 8:47 AM
Hi,
why want you do that? By design the order of records in a table doesn't matter.
If you want to make use of the records you have to SELECT them.
When you SELECT them you can have an ORDER BY, voila it's sorted.
Let's say you inserted a bunch of rows ORDERED into the table. Well it's fine...
You do a SELECT * from table
The question is: will you get the rows ordered? The answer: yes, no, maybe
You have to SELECT and ORDER BY to be sure to have the table ordered.
I.E. databases are storing rows in a storage-efficient way (ORACLE uses so-called blocks for that).
When you SELECT it visits all blocks that contain the rows and give them back in a efficient (not ordererd ) way back. The database uses a Cost based optimizer (CBO) to do that.
The result set can than be ordered by the query plan given by the CBO.
Hoe that helps