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!

Other ways to convert number nested table to varchar2 nested table

20197Mar 13 2009 — edited Mar 14 2009
I am looking for a direct way to assign a number nested table to a varchar2 nested table. I know of two ways. Method 3 raises an ORA-06550. What other efficient ways are available? My database version is 10.2.0.4
create or replace type num_ntt is table of number;
/
create or replace type vc2_ntt is table of varchar2(4000);
/
declare
  num  num_ntt := num_ntt();
  vc2  vc2_ntt := vc2_ntt();
begin
   for i in 1..10 loop
     num.extend;
     num(i) := i;
   end loop;
   
   --Method 1
   for i in 1..num.count loop
     vc2.extend;
     vc2(i) := num(i);
   end loop;
   
   --Method 2
   select * bulk collect into vc2 from table( num );
   
   --Method 3
   vc2 := num;
end;
/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 11 2009
Added on Mar 13 2009
5 comments
451 views