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 > how to use array in db2 stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-23-03, 21:41
vonfking vonfking is offline
Registered User
 
Join Date: Dec 2003
Posts: 5
how to use array in db2 stored procedure

I want to run a stored procedure which will insert multiple rows in the database. So I need to pass in the stored procedure an array of variables and loop over it.

How I can pass complex datasets like arrays,lists, etc. in the stored procedure? How I can loop over that datasets in the stored procedure?
Reply With Quote
  #2 (permalink)  
Old 12-29-03, 05:14
jsander jsander is offline
Registered User
 
Join Date: Apr 2003
Posts: 191
Re: how to use array in db2 stored procedure

Hi,

the task seems a bit awkward. First of all, if you want to process complex input parameters, you will probably need to define your stored procedures using external functions, like c or java code.

Second, you will have to pass some type of pointer, e.g. a file name or a key value for parameter tables.

I am not quite sure if this is going to be batch processing. If so, consider using a scripting tool instead.

Johann

Quote:
Originally posted by vonfking
I want to run a stored procedure which will insert multiple rows in the database. So I need to pass in the stored procedure an array of variables and loop over it.

How I can pass complex datasets like arrays,lists, etc. in the stored procedure? How I can loop over that datasets in the stored procedure?
Reply With Quote
  #3 (permalink)  
Old 01-02-04, 08:46
Dipanjan Dipanjan is offline
Registered User
 
Join Date: Sep 2003
Posts: 84
If your data is less than equal to 4000 bytes then you can accept the data as varchar in your sp and then parse it.
Or, you can pass the data as string ( in XML data format) in which case you can use the dxxShredXML function to insert the data into DB2 tables.
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