When we insert a table based on select, then why it change the order of the rows in the new table.
For some reason we do not want to change the rows order
insert into new_table
select col1,col2,col3 from old_table
Data in a relational structure has no inherent order.
Mean there is no way we can get the same order as of query?
Appreciate your help.
use order by if you insist
I am inserting new-table in D2K Reports BeforReport and I have tried to use Order by but it gives error else it works fine.
As Jeff said, there is no inherent row order in tables in Oracle.
It does not matter what order you *try* to insert records into a table, they may or may not actually get inserted in that order. Further, when you try to SELECT these same records back out, you may or may not get them in the order that they exist in the table.
The only way to guarantee the order of rows inside the table itself is to make it an index-organized table. Even then, the order of the records once SELECTed cannot be guaranteed.
Simply put, you *need* an ORDER BY in any SELECT if you care about the order. Period.
Click Here to Expand Forum to Full Width