# Storing sorted data in VB Oracle



## prabhatmohit (May 25, 2010)

Hey friends,

I am developing an applicationn using VB 6 and Oracle.
Can any1 tell me how to make sure that when I store data in Oracle db through VB, It is stored automatically in sorted form by a field empcode?

Thanks a lot!


----------



## Garbage (May 25, 2010)

AFAIK, there is no guaranty that data will always stored sorted based on emp_id, you can retrieve it using "ORDER BY" clause to get it in order.


----------



## krishnandu.sarkar (May 25, 2010)

^Thats true


----------



## vamsi360 (May 27, 2010)

or you can write an SQL query  to export the sorted results to another table.

Or you can write a check statement while inserting.

CHECK (new_id>MAX(select id from table_name))
//then insert here.

Second method is what you have asked for.


----------

