If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > create type and as table of equlent + bulk collect in db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-11, 00:18
ranjitkum ranjitkum is offline
Registered User
 
Join Date: Jan 2011
Posts: 1
create type and as table of equlent + bulk collect in db2

Hi All,
This is ranjit,i am porting oracle procedures to db2 .,when i am doing facing problem at "bulk collect ",please help me out how to solve this.

below i added oracle package and equaltent db2 package which is throwing error at bulk collect.

--------------------------------------------------------------------------------------------
drop table test_table ;
create table test_table
(
col1 number (20, 0),
col2 number (1, 0)
) ;
insert into test_table values (1,2) ;
insert into test_table values (3,4) ;

commit;
--------------------- Oracle procedure ------------
drop type test_t ;
drop type test ;
create type test as object
(
c1 number (20, 0),
c2 number (1, 0)
) ;
/

create type test_t as table of test ;
/

create or replace procedure testprocedure (test_t_obj out test_t )
is
begin
select test(col1,col2) bulk collect into test_t_obj from test_table ;
end testprocedure ;
/

declare
test_t_obj_pram test_t := test_t () ;
begin
testprocedure(test_t_obj_pram) ;
dbms_output.put_line('>>>>>>>>>>'||test_t_obj_pram .count) ;
end ;
/

------------------ DB2 Facing issue at Bulk collect--------
drop type test_t ;
drop type test ;
create type test as row
(
c1 number (20, 0),
c2 number (1, 0)
) ;

create type test_t as test array integer ;

create or replace procedure testprocedure (test_t_obj out test_t )
is
begin

select test(col1,col2) bulk collect into test_t_obj from test_table ;
//// GETTING ERROR HERE about test(col1,col2)

end testprocedure ;

/

declare

test_t_obj_pram test_t := test_t () ;

begin

testprocedure(test_t_obj_pram) ;
dbms_output.put_line('>>>>>>>>>>'||test_t_obj_pram .count) ;

end ;
/


Thanks & Regards,
ranjit
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On