I am working in Oracle 11gR2 running on Linux RHEL machine
I have created a procedure which uses a collection as input parameter.
create or replace TYPE rec AS
OBJECT (
id NUMBER(6),
prcs_d DATE,
code VARCHAR2(3 CHAR)
);
create or replace TYPE tab AS TABLE OF rec;
PROCEDURE upd_table (i_tab in out nocopy tab)
IS
v_count := i_tab.count;
for i IN 1 ..v_count
loop
dbms_output.put_line (i_tab(i).id);
end loop;
end;
How can create or have the collection i_tab sorted/ordered by on the column id in my procedure so that the ids which gets printed are in a ascending or descending order ?
Can i create another collection "locally" where I have the records sorted on the basis of id column after we receive that i_tab collection as input parameter and then parse through the records one by one inside the loop ?