How to eliminate duplicates from record types?
Below code errors out with "Wrong number of arguments in call to MULTISET...." error.
Declare
TYPE ln_x_tab IS RECORD(x1 number
,x2 VARCHAR2(4000)
,x3 VARCHAR2(4000)
,x4 VARCHAR2(4000)
,x5 VARCHAR2(4000)
);
TYPE ln_x_type IS TABLE OF ln_x_tab INDEX BY BINARY_INTEGER;
ln_x1 ln_x_type;
ln_dist_x1 ln_x_type;
gc_stmt varchar2(4000);
Begin
gc_stmt := ' SELECT x1, x2, x3, x4, x5 FROM table WHERE dynamic_conditions;
EXECUTE IMMEDIATE gc_stmt BULK COLLECT INTO ln_x1;
ln_dist_x1:= ln_x1 MULTISET UNION DISTINCT ln_x1;
End;
I need ln_dist_x1 to have distinct records from table. Please help.