Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2013
    Posts
    4

    Unanswered: passing variable number of parameters in DB2 procedure

    Hi ,

    I need to pass variable number of parameters in DB2 procedure. So at one time it can be 5, another time it can be 8. Any help would be appreciated.

    Thanks

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    How would call it? How would you define it? How would DB2 know which would be IN, OUT, or INOUT parameters?

    Andy

  3. #3
    Join Date
    Jul 2009
    Location
    NY
    Posts
    963

    Thumbs up 2 ways to do it

    Quote Originally Posted by gaurav3108 View Post
    Hi ,

    I need to pass variable number of parameters in DB2 procedure. So at one time it can be 5, another time it can be 8. Any help would be appreciated.

    Thanks
    You have to get the input parameters as arrays .
    Another way is override the SP with same name but different external names
    and different input parameters.

    Lenny
    Last edited by Lenny77; 04-24-13 at 17:33.

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    You can pass arrays to SP's if you have 9.7 or above (not sure about others). Try google to get details.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  5. #5
    Join Date
    Jun 2002
    Posts
    15
    You could use a XML parameter for your optional parameters.

  6. #6
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    For your optional parameters you may also use default values.
    e.g. IN param8 SMALLINT DEFAULT 1
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

Posting Permissions

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