pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Thomas <paul@tmsl.demon.co.uk>
To: Tim Penhey <tim@penhey.net>
Cc: pgsql-jdbc @ postgresql . org <pgsql-jdbc@postgresql.org>
Subject: Re: Calling functions with numeric parameters
Date: Wed, 15 Sep 2004 13:38:40 +0100
Message-ID: <20040915133840.A11339@bacon> (raw)
In-Reply-To: <41482F1C.4060503@penhey.net>
References: <41482F1C.4060503@penhey.net>


On 15/09/2004 13:01 Tim Penhey wrote:
> Hi All,
> 
> I have a plpgsql function that takes a numeric parameter.  It is for a 
> price in a table.  The table has the price declared as numeric(10,2), and 
> the function parameter is just numeric.  However in Java I have the price 
> represented as a double.
> 
> Using jdbc setDouble for a parameter for the function causes causes an 
> ERROR saying that the function taking a double precision parameter does 
> not exist (which is obviously correct).
> 
> What do other people do?
> 
>    Is there a way to pass a numeric parameter through JDBC?
>    Should the parameter to the function be a double which is the "cast" 
> into the numeric inside the function?
> 
> Your ideas are welcome.


I've not tried it myself but BigDecimal seems to the one to use.

HTH

-- 
Paul Thomas
+------------------------------+-------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for Business           |
| Computer Consultants         | http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+-------------------------------------------+



view thread (4+ messages)  latest in thread

Message-ID: <20040915133840.A11339@bacon>
Permalink:  ../20040915133840.A11339@bacon/
Also on:    postgresql.org/message-id/20040915133840.A11339@bacon

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: paul@tmsl.demon.co.uk, tim@penhey.net
  Subject: Re: Calling functions with numeric parameters
  In-Reply-To: <20040915133840.A11339@bacon>
  References: <41482F1C.4060503@penhey.net> <20040915133840.A11339@bacon>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox