Skip site navigation (1) Skip section navigation (2)

Re: JDBC CallableStatement bug on functions with return parameter

From: John LH <johnlh(at)aquafold(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC CallableStatement bug on functions with return parameter
Date: 2011-02-05 16:21:47
Message-ID: 4D4D791B.30704@aquafold.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
  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
>

In response to

Responses

pgsql-jdbc by date

Next:From: Kevin GrittnerDate: 2011-02-05 17:43:33
Subject: Re: JDBC CallableStatement bug on functions with return parameter
Previous:From: Radosław SmoguraDate: 2011-02-05 16:08:24
Subject: Re: ssl connection strangely stops working

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group