Hi Experts,
I have written the following code to remove the duplicate records from the collection based on first two columns data.
But it's giving the error
PLS-00306: wrong number or types of arguments in call to 'MULTISET_UNION_DISTINCT'
Please help me.
DECLARE
TYPE category_type is RECORD (
col1 VARCHAR2(6),
col2 VARCHAR2(10),
col3 NUMBER);
TYPE category_tab IS TABLE OF category_type;
v_category_data category_Tab := category_tab();
v_temp category_Tab;
begin
v_category_data.extend(7);
v_category_data(1):= category_type('A','B',1);
v_category_data(2):= category_type('A','B',1);
v_category_data(3):= category_type('B','C',2);
v_category_data(4):= category_type('A','B',2);
v_category_data(5):= category_type('A','C',2);
v_category_data(3):= category_type('B','C',5);
v_category_data(3):= category_type('B','D',8);
for i in 1..v_category_data.count
loop
dbms_output.put_line(v_category_data(i).col1 || v_category_data(i).col2 || v_category_data(i).col3 );
end loop;
v_temp := v_category_data ;
v_category_data := v_category_data MULTISET UNION DISTINCT v_temp ;
for i in 1..v_category_data.count
loop
dbms_output.put_line(v_category_data(i).col1 || v_category_data(i).col2 || v_category_data(i).col3 );
end loop;
end;
Expected O/P:
AB2
AC2
BC5
BD8
Thanks in advance.