Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    8

    Unanswered: invoke udf through jdbc using input parameters

    i have a simple udf that i can invoke such as :

    select doSomething('input 1', 'input 2', 'input 3') from sysibm.sysdummy1;

    but i'd like to invoke this from java/jdbc passing input parameters.

    the following :
    select doSomething(?,?,?) from sysibm.sysdummy1;

    gives a sql-418. i don't think that it likes the parameters in the select clause. any ideas on how i can do this?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You need to cast the parameters to the correct data types so that DB2 can determine the UDF properly.

    Andy

  3. #3
    Join Date
    Dec 2010
    Posts
    8
    thanks. it seemed silly to have to cast these, but it works.

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The reason you need to cast them is because DB2 allows you to have multiple UDFs with the same name (overloading). So in order for DB2 to know which UDF to use, you have to cast the parameters so it knows which one you want.

    Andy

Posting Permissions

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