How to use Multiset in packege body?
501297Mar 18 2010 — edited Mar 19 2010Hi!
I have working example:
CREATE OR REPLACE TYPE varchar2_ntt AS TABLE OF number;
create or replace PROCEDURE display (
nt_in IN varchar2_ntt
) IS
i PLS_INTEGER;
BEGIN
i := nt_in.FIRST;
WHILE i IS NOT NULL LOOP
DBMS_OUTPUT.PUT( nt_in(i) || ' ' );
i := nt_in.NEXT(i);
END LOOP;
DBMS_OUTPUT.NEW_LINE;
END display;
Run From SQL:
set serveroutput on
declare
nt0 varchar2_ntt := varchar2_ntt(1,5,9,12,17,19);
nt1 varchar2_ntt := varchar2_ntt(5,12,18);
BEGIN
display(nt0 MULTISET UNION nt1 );
END;
Getting:
1 5 9 12 17 19 5 12 18
PL/SQL procedure successfully completed.
I would like to use it in package but cannot compile it.
error is:
an alias is not allowed here (reserved for XMLCOLATTVAL, XMLFOREST and XMLATTRIBUTES only).
If creating standalone procedure:
create or replace PROCEDURE display_multiset is
nt0 varchar2_ntt := varchar2_ntt(1,5,9,12,17,19);
nt1 varchar2_ntt := varchar2_ntt(5,12,18);
BEGIN
display(nt0 MULTISET UNION nt1 );
END;
... also same error, but procedure works.
Please advise how to compile package.
I tried to use "execute immediate" but did not get positive results.
With regards, ALA.