I have a question about what is legal in an external UDF written in C and
possible work-arounds.
I know that an SQL Scalar UDF can be created with the READS SQL DATA
option, and that it can contain an SQL "SELECT" statement and return that
data. However, we need to create a UDF that does some manipulations best
accomplished using a programming language (in this case, C).
My question: Can we create an External Scalar UDF written in C that has
embedded SQL in it, so that the UDF can SELECT a row of data from the
database and then do some processing on the data using C language logic
before returning a scalar result? My review of the relevant DB2 manuals
seems to indicate that this would be illegal ("NO SQL" is a mandatory
clause on the CREATE FUNCTION statement), and that only an SQL UDF with the
READS SQL DATA option can issue a SELECT statement in the UDF. So far, I
can't find anything to contradict this view.
What I'm wondering is, if I can't embed SQL in my external C UDF, are there
alternate approaches to consider? For example, can I write two UDFs, the
first of which is an SQL UDF which in its SELECT invokes an External UDF
written in C? The RETURN statement of the SQL UDF would look something
like this:
RETURN SELECT my_external_UDF(column1) from table.
Has anyone tried a work-around like this, or something else?
Thanks.
Steve Westfall
Equifax, Inc.
This message contains information from Equifax, Inc. which may be
confidential and privileged. If you are not an intended recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited. If you have
received this transmission in error, please notify by e:mail
[EMAIL PROTECTED]
=====
To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
For other info (and scripts), see http://people.mn.mediaone.net/scottrmcleod