Page 1 of 1

User defined function in SELECT-WHERE statement

PostPosted: Tue Dec 16, 2008 3:51 pm
by coboler
Hi all,

I have a problem with the syntaxis to use a UDF in an SQL:
- I have created an UDF which delivers a number.
- I would like to use this number for a condition in the WHERE option of a SELECT statement.

I would like to do this:

Function defined -->
db.function(date)=number

SQL statement -->
select *
from table
where column_of_table = db.function(date)

Actually, it is a bit more complicated, but I would like to know if this is what I am doing wrong...

Thanks!

Re: User defined function in SELECT-WHERE statement

PostPosted: Tue Dec 16, 2008 7:18 pm
by dick scherrer
Hello,

Issue the function and retrieve the number to a host variable.

Use the host variable in the sql.

Re: User defined function in SELECT-WHERE statement

PostPosted: Tue Dec 16, 2008 7:50 pm
by coboler
I could finally fix it in the way I was doing.
Anyway, thanks for your answer Dirk!!

Re: User defined function in SELECT-WHERE statement

PostPosted: Wed Dec 17, 2008 6:13 am
by dick scherrer
Hello,

Good to hear it is working :)

If you post how you fixed the problem, it will probably help someone else who encounters the same situation.