I have successfully compiled the following UDF sample for DB2 8.1 on AIX
4.3.3. When I try to 'db2 define function' command below, I get the
following errors:
DB21034E The command was processed as an SQL statement because it was
not a valid Command Line Processor command. During SQL processing it
returned:
SQL0204N "IN1" is an undefined name. LINE NUMBER=1. SQLSTATE=42704
Do I need to run bind?
my library is /home/maddev/sqllib/function/udfsrv
I see that .product is compiled when I dump out that file:
[83] m 0x10000a90 1 1 0x02 0x0020 .product
[84] a4 0x00000045 0 0 2 0 0 0
From Application Development Guide:
--------------------------------------------------------------------------
The following is an example of a C/C++ UDF that returns the product of
its two input arguments:
SQL_API_RC SQL_API_FN product ( SQLUDF_DOUBLE *in1,
SQLUDF_DOUBLE *in2,
SQLUDF_DOUBLE *outProduct,
SQLUDF_NULLIND *in1NullInd,
SQLUDF_NULLIND *in2NullInd,
SQLUDF_NULLIND *productNullInd ,
SQLUDF_TRAIL_AR GS )
{
*outProduct = (*in1) * (*in2);
return (0);
}
The corresponding CREATE FUNCTION statement for this UDF is as follows:
CREATE FUNCTION product( double in1, double in2 )
RETURNS double
LANGUAGE c
PARAMETER STYLE sql
NO SQL
FENCED THREADSAFE
DETERMINISTIC
RETURNS NULL ON NULL INPUT
NO EXTERNAL ACTION
EXTERNAL NAME ’udfsrv!product ’
4.3.3. When I try to 'db2 define function' command below, I get the
following errors:
DB21034E The command was processed as an SQL statement because it was
not a valid Command Line Processor command. During SQL processing it
returned:
SQL0204N "IN1" is an undefined name. LINE NUMBER=1. SQLSTATE=42704
Do I need to run bind?
my library is /home/maddev/sqllib/function/udfsrv
I see that .product is compiled when I dump out that file:
[83] m 0x10000a90 1 1 0x02 0x0020 .product
[84] a4 0x00000045 0 0 2 0 0 0
From Application Development Guide:
--------------------------------------------------------------------------
The following is an example of a C/C++ UDF that returns the product of
its two input arguments:
SQL_API_RC SQL_API_FN product ( SQLUDF_DOUBLE *in1,
SQLUDF_DOUBLE *in2,
SQLUDF_DOUBLE *outProduct,
SQLUDF_NULLIND *in1NullInd,
SQLUDF_NULLIND *in2NullInd,
SQLUDF_NULLIND *productNullInd ,
SQLUDF_TRAIL_AR GS )
{
*outProduct = (*in1) * (*in2);
return (0);
}
The corresponding CREATE FUNCTION statement for this UDF is as follows:
CREATE FUNCTION product( double in1, double in2 )
RETURNS double
LANGUAGE c
PARAMETER STYLE sql
NO SQL
FENCED THREADSAFE
DETERMINISTIC
RETURNS NULL ON NULL INPUT
NO EXTERNAL ACTION
EXTERNAL NAME ’udfsrv!product ’