-
Hi all,
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
e.g
insert into new_table
(cola,colb,colc)
select col1,col2,col3 from old_table
where -------
and -------;
Thanks
-
Data in a relational structure has no inherent order.
Jeff Hunter
-
Thanks Marist,
Mean there is no way we can get the same order as of query?
Appreciate your help.
-
use order by if you insist
-
Thanks,
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.
Any Idea.
Thanks..
-
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.
- Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|