Search code examples
cdb2user-defined-functionsdb2-luw

DB2 C UDF parameters in array


I'm using DB2 10.5 Linux and I Need to create a C UDF that can get more than 150 arguments ( plus the null indicators ).

It is possible to pass the whole row like SELECT MYSCHEMA.MYUDF(*) FROM TABLE or is there a way to pass the arguments in an array like PARAMETER STYLE MAIN in procedures ?

I haven't found any example or documentation for this.


Solution

  • is not possible to have more than 90 parameters, however I was able to solve the problem using BLOB as input.

    then create the blob on query with (columns are INT)

    HEXTORAW(HEX(COLUM_NAME_1))||HEXTORAW(HEX(COLUM_NAME_2)) 
    

    then in C using a packed structure.

    works much faster and reduces the code lines in on the C udf.