Re: How to use SQL functions with parameters?

Armin Waibel <[email protected]>
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Hi Francesco,

the oql-support isn't fully implemented.
http://db.apache.org/ojb/status.html

Maybe it's possible to do a workaround by using the Criteria-API
http://db.apache.org/ojb/docu/guides/odmg-guide.html#no-oql
http://db.apache.org/ojb/docu/guides/query.html#subqueries

regards,
Armin


Francesco Martinelli wrote:
> Dear all,
> I need to filter a query using an SQL function.
> 
> In SQL this would be achieved with the following statement:
>     select * from myTable where key in (select * from myFunc(myParam))
> 
> I tried the same with ODB-ODBC, and this worked using the following query
> string:
>     String oqlQuery = "select myObject from " + myClass.getName() +
>         " where key IN (select * from myFunc(" + myParam.toString() + "))";
> 
> However it generated an error at the moment of binding the parameter using
> the following query string:
>     String oqlQuery = "select myObject from " + myClass.getName() +
>         " where key IN (select * from myFunc($1))";
> 
> After creating the qury with:
>       query.create(oqlQuery);
> 
> The error (QueryParameterCountInvalidException) was generated at the
> following line:
>       query.bind((Float)myParam);
> 
> Can anybody tell me if it is possible to use the query string in the
> second form?
> 
> Thank you,
> Francesco.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.