SORT DATA USING INDEX



IBM's flagship relational database management system

SORT DATA USING INDEX

Postby ramu65 » Tue May 06, 2014 8:49 pm

hi
I am a beginner in DB2.I created a table and also a unique index for the table.But after inserting data into the table,the contents are not in sorted order(according to the index).

index creation:
create unique index ai_index on xxxxx(jnt_id asc)

where jnt_id is column in table of type char(4)

What might be the possible reason for the data not to be in sorted order??Is there any other method to sort the available data??
ramu65
 
Posts: 29
Joined: Sat Feb 08, 2014 10:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT DATA USING INDEX

 

Re: SORT DATA USING INDEX

Postby enrico-sorichetti » Tue May 06, 2014 9:09 pm

as per db2/sql manuals
the only way to retrieve the rows in a specific order is ...
the name tells - use the ORDER clause
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2644
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post