I've been looking for bits and pieces of code to help solve this problem - as I will continue to do but have had success getting and providing answers on this forum.
I have a home grown application which has very poor/limited functionality outside of what it was made to do - but it can execute a stored procedure. I have a starting string I would like to pass to a stored procedure then have a sorted version passed back to my application.
The starting value is a long string with each item separated by a pipe.
Within each item is a DEPT value which is treated as a string in my application but needs to be sorted as a number. The next piece of the item is the ITEMCODE which can be a 5 to 10 digit integer. The final piece of the item is the description (DESC). It can potentially be 64000 alpha characters but averages about 200 characters.
Starting unsorted value passed to Oracle via SP:
2-6055159:STORAGE_CUBE_BLUE|001-6055154:STORAGE_BOXES_RED|0-50020:FLATWARE_10PC|01-6055159:STORAGE_BOXES_BLUE
Desired sorted result passed back to application:
0-50020:FLATWARE_10PC|001-6055154:STORAGE_BOXES_RED|01-6055159:STORAGE_BOXES_BLUE|2-6055159:STORAGE_CUBE_BLUE
Perhaps importing this into a temp Oracle table would make it easier since my application can run stored procs.
Before the sort:
[pre]DEPT ITEMCODE ITEM
2 6055159 STORAGE_CUBE_BLUE
001 6055154 STORAGE_BOXES_RED
0 50020 FLATWARE_10PC
01 6055159 STORAGE_BOXES_BLUE[/pre]
Sort order DEPT then ITEMCODE
After the sort:
[pre]DEPT ITEMCODE ITEM
0 50020 FLATWARE_10PC
001 6055154 STORAGE_BOXES_RED
01 6055159 STORAGE_BOXES_BLUE
2 6055159 STORAGE_CUBE_BLUE[/pre]
Then rebuilt the desired output string as a single string with the delimeters back in place.
I have a home grown application which has very poor/limited functionality outside of what it was made to do - but it can execute a stored procedure. I have a starting string I would like to pass to a stored procedure then have a sorted version passed back to my application.
The starting value is a long string with each item separated by a pipe.
Within each item is a DEPT value which is treated as a string in my application but needs to be sorted as a number. The next piece of the item is the ITEMCODE which can be a 5 to 10 digit integer. The final piece of the item is the description (DESC). It can potentially be 64000 alpha characters but averages about 200 characters.
Starting unsorted value passed to Oracle via SP:
2-6055159:STORAGE_CUBE_BLUE|001-6055154:STORAGE_BOXES_RED|0-50020:FLATWARE_10PC|01-6055159:STORAGE_BOXES_BLUE
Desired sorted result passed back to application:
0-50020:FLATWARE_10PC|001-6055154:STORAGE_BOXES_RED|01-6055159:STORAGE_BOXES_BLUE|2-6055159:STORAGE_CUBE_BLUE
Perhaps importing this into a temp Oracle table would make it easier since my application can run stored procs.
Before the sort:
[pre]DEPT ITEMCODE ITEM
2 6055159 STORAGE_CUBE_BLUE
001 6055154 STORAGE_BOXES_RED
0 50020 FLATWARE_10PC
01 6055159 STORAGE_BOXES_BLUE[/pre]
Sort order DEPT then ITEMCODE
After the sort:
[pre]DEPT ITEMCODE ITEM
0 50020 FLATWARE_10PC
001 6055154 STORAGE_BOXES_RED
01 6055159 STORAGE_BOXES_BLUE
2 6055159 STORAGE_CUBE_BLUE[/pre]
Then rebuilt the desired output string as a single string with the delimeters back in place.