Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

multiset except (minus)

549039Oct 10 2011 — edited Oct 10 2011
Hi guys,

I am planning to loop throu the rest of a collection elements substracting each time one

My code is:
declare 
 type tr is record(
   id number,
   ref varchar2(32)
 );
 type tc is table of tr;
 col tc;
 a tc;
 b tc;
 cursor c is
 select ar_item_id,item_ref from ar_items where rownum < 5; 
begin
  open c;
  fetch c bulk collect into col;
  close c;
  
  for i in col.first..col.last loop
    b := tc();
    b.extend;
    b(1) := col(i);
    a := tc();
    a := col multiset except b;
    dbms_output.put_line('colectia reminder '||i);
    for n in a.first..a.last loop
      dbms_output.put_line(a(n).ref);
    end loop;
    dbms_output.put_line(a.count);
  end loop;
end;
but it fails with
ORA-06550: line 22, column 10:
PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
ORA-06550: line 22, column 5:
PL/SQL: Statement ignored

although with union instead of except works...

How to use a minus between collections?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2011
Added on Oct 10 2011
5 comments
1,133 views