One approach that I implemented was:
Step 1: Get the max and min of col1
Step 2: Do a sparse lookup on an Oracle table with following query to generate the ascending record values: SELECT R FROM ( SELECT LEVEL AS R FROM DUAL CONNECT BY LEVEL<=Orchestrate.max(col1)) WHERE R>=Orchestrate.min(col1)
But, I am seeking an alternative approach, something that does not employ a database interaction at all.
Can I be achieved?
Please suggest.
Warm Regards,
Kumarjit.
Pain is the best teacher, but very few attend his class..
@Ray: As Craig has mentioned, the output would be a sorted column(col2), values of which will be continuous and range from min(col1) to max(col1).
@Craig: Looping does work good in this case where the input is already sorted in ascending order, but what if the input column values are staggered(like below), and I do not want to use any sort stage/inline sort feature to sort the column.
kumarjit wrote:My requirement is to get a single column output(say Col2), with record values ranging between min(col1) and max(col1), and in a ascending order
kumarjit wrote: I do not want to use any sort stage/inline sort feature to sort the column.
How would you ever hope to output values in ascending order on the output without using some form of sort?
If you input order is important to you in any way - just add a column which maintains the input order (eg use @INROWNUM) and then sort it again after you've calculated the missing numbers - though considering your output is just a sequence of numbers this is all quite a ridiculous requirement?