Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    5

    Unanswered: 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?

  2. #2
    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

    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?

  3. #3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •