Re: JDBC CallableStatement bug on functions with return parameter
Re: JDBC CallableStatement bug on functions with return parameter
От:
"Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Дата:
John LH wrote: > I have a function "sales_tax (in subtotal money) RETURNS money" > I register the parameters and then execute the statement, but it > fails with the error message : > > ERROR: function public.sales_tax(double precision) does not exist What class of Java object are you trying to use for the parameter? -Kevin
Re: JDBC CallableStatement bug on functions with return parameter
От:
John LH <johnlh@aquafold.com>
Дата:
Hi,
I create the CallableStatement with this :
callStatement = conn.prepareCall("{ ? = CALL "public"."sales_tax"(?) }");
For the return parameter I use :
callStatement.registerOutParameter(1, java.sql.Types.FLOAT);
For the function parameter I use :
callStatement.setObject(2, new Float(25.25));
After this, the Jdbc4CallableStatement SQL is :
select * from "public"."sales_tax"(null,25.25) as result
When I callStatement.execute() I get this :
org.postgresql.util.PSQLException: ERROR: function
public.sales_tax(double precision) does not exist
I've also tried the combination and results of ...
===
java.sql.Types.DOUBLE/Double
org.postgresql.util.PSQLException: ERROR: function
public.sales_tax(double precision) does not exist
===
java.sql.Types.NUMERIC/BigDecimal
org.postgresql.util.PSQLException: ERROR: function
public.sales_tax(numeric) does not exist
thanks
-John
On 2/5/2011 7:23 AM, Kevin Grittner wrote:
> John LH wrote:
>
>> I have a function "sales_tax (in subtotal money) RETURNS money"
>
>> I register the parameters and then execute the statement, but it
>> fails with the error message :
>>
>> ERROR: function public.sales_tax(double precision) does not exist
>
> What class of Java object are you trying to use for the parameter?
>
> -Kevin
>
Re: JDBC CallableStatement bug on functions with return parameter
От:
Lew <noone@lewscanon.com>
Дата:
(Please do not top-post.)
John LH wrote:
>
> I create the CallableStatement with this :
>
> callStatement = conn.prepareCall("{ ? = CALL "public"."sales_tax"(?) }");
>
> For the return parameter I use :
>
> callStatement.registerOutParameter(1, java.sql.Types.FLOAT);
>
> For the function parameter I use :
>
> callStatement.setObject(2, new Float(25.25));
You do realize that 'float' ('Float') is pretty much the worst type to use for
monetary facts, right?
--
Lew
Ceci n'est pas une fenêtre.
.___________.
|###] | [###|
|##/ | *\##|
|#/ * | \#|
|#----|----#|
|| | * ||
|o * | o|
|_____|_____|
|===========|