Reputation:
Is it possible to order the result of select query on a db2 database case insensitively?
For example: I want to have all names that start with an "a" or "A" sorted together.
Abraham
aron
andrea
Annica
brian
Benjamin
Now it's like this:
aron
andrea
brian
Abraham
Annica
Benjamin
Upvotes: 2
Views: 2402
Reputation: 4546
Assuming you're on DB2/400 (assuming from another post of yours) then you'd want to change the sort sequence of the job requesting that query to be SRTSEQ(*LANGIDSHR). You can also (and should) build an index w/that setting so there's an index to use.
Running the lower() function will force DB2 to evaluate the function for each row and build a huge temp table to handle it. It will work... but work poorly.
Upvotes: 1