Sort INDEX BY BINARY_INTEGER
I have two columns with type DATE: start_date and end_date, I would like to merge them into one sorted column.
I can declare: TYPE merge_date_column IS TABLE OF DATE
INDEX BY BINARY_INTEGER
And then insert the start_date and end_date columns values into it, but the problem is that I donít know how to sort this type.
Is there any way to sort this type, or is it any better way to do it?
Not quite sure how you want to handle duplicates or if you are using times or just dates.
If it is just dates and you want a list of unique dates, convert them to J format (days since sometime way back) or YYYYMMDD. Once they are numeric, it is simple to sort.
TYPE tab_num IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
BULK COLLECT INTO v_in
WHERE ROWNUM < 20;
FOR i IN NVL(v_in.first,0)..NVL(v_in.last,-1) LOOP
v_out(v_in(i)) := 0;
FOR i IN 1..NVL(v_out.COUNT,-1) LOOP
v_in(i) := v_out.first;
FOR i IN 1..NVL(v_in.COUNT,-1) LOOP
sort INDEX BY BINARY_INTEGER
Thanks for your help It helps me a loot !!!
Click Here to Expand Forum to Full Width