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 > ARRAY in STORED PROCEDURE

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-11, 01:44
rajshri rajshri is online now
Registered User
 
Join Date: Dec 2011
Posts: 14
Cool ARRAY in STORED PROCEDURE

hi all,
can u explain me about arrays in stored procedure with example.
i created array type.
for execute SP i used RAZORSQL, in this array type is not supported with in or out parameter.

do help me.
thanks.
Reply With Quote
  #2 (permalink)  
Old 12-06-11, 01:52
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Have you seen this page ...

IBM DB2 9.5 Information Center for Linux, UNIX, and Windows

Use the search function to find more info.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 12-06-11, 02:13
rajshri rajshri is online now
Registered User
 
Join Date: Dec 2011
Posts: 14
Cool Array

hi..
hav gone thro this..
bt not getting that much.
instead of using
insert into persons(id, name)
(select T.i, T.n from UNNEST(ids, names) as T(i, n));

can we use something like ids[1] or names[1];

and one more thing..
here they have hard code array value.

can i do like
set ids = ARRAY[0,0,0] or
set names = ARRAY[null, null, null]

REPLY SOON...
Reply With Quote
  #4 (permalink)  
Old 12-06-11, 02:34
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Quote:
Originally Posted by rajshri View Post
insert into persons(id, name)
(select T.i, T.n from UNNEST(ids, names) as T(i, n));

can we use something like ids[1] or names[1];
Of course you can. It will be "insert into persons values(ids[1],names[1])"

Quote:
and one more thing..
here they have hard code array value.

can i do like
set ids = ARRAY[0,0,0] or
set names = ARRAY[null, null, null]
0 and null -- isn't that hard coding?

Quote:
REPLY SOON...
Can I remind something,pl? If you want to get a "Reply soon" , pay someone!!! dont expect it from a free forum.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 12-06-11, 02:45
rajshri rajshri is online now
Registered User
 
Join Date: Dec 2011
Posts: 14
Cool Array

hi..
thanks..

they have mentioned like
set ids = ARRAY[5,6,7];
set names = ARRAY['Bob', 'Ann', 'Sue'];

nw if i want to pass array list into
set ids = array[my list];
hw do i pass it..

actually i m very new with DB2 and its procedure..

n sorry for saying reply soon..
Reply With Quote
  #6 (permalink)  
Old 12-06-11, 17:08
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Quote:
Originally Posted by rajshri View Post
hi..
thanks..

they have mentioned like
set ids = ARRAY[5,6,7];
set names = ARRAY['Bob', 'Ann', 'Sue'];

nw if i want to pass array list into
set ids = array[my list];
hw do i pass it..

actually i m very new with DB2 and its procedure..

n sorry for saying reply soon..
You cant do the list thing! You can assign
id[1]=1
id[2]=7
etc.

Let me know if you find otherwise
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
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