pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedCalling functions with numeric parameters
4+ messages / 3 participants
[nested] [flat]
* Calling functions with numeric parameters
@ 2004-09-15 12:01 Tim Penhey <tim@penhey.net>
0 siblings, 2 replies; 4+ messages in thread
From: Tim Penhey @ 2004-09-15 12:01 UTC (permalink / raw)
To: pgsql-jdbc
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.
Tim
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Calling functions with numeric parameters
@ 2004-09-15 12:36 Dave Cramer <pg@fastcrypt.com>
parent: Tim Penhey <tim@penhey.net>
1 sibling, 1 reply; 4+ messages in thread
From: Dave Cramer @ 2004-09-15 12:36 UTC (permalink / raw)
To: Tim Penhey <tim@penhey.net>; +Cc: pgsql-jdbc
Tim,
Use setBigDecimal
Dave
On Wed, 2004-09-15 at 08: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.
> Tim
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Dave Cramer
519 939 0336
ICQ # 14675561
www.postgresintl.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Calling functions with numeric parameters
@ 2004-09-15 12:38 Paul Thomas <paul@tmsl.demon.co.uk>
parent: Tim Penhey <tim@penhey.net>
1 sibling, 0 replies; 4+ messages in thread
From: Paul Thomas @ 2004-09-15 12:38 UTC (permalink / raw)
To: Tim Penhey <tim@penhey.net>; +Cc: pgsql-jdbc
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 |
+------------------------------+-------------------------------------------+
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Calling functions with numeric parameters
@ 2004-09-15 12:49 Tim Penhey <tim@penhey.net>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 0 replies; 4+ messages in thread
From: Tim Penhey @ 2004-09-15 12:49 UTC (permalink / raw)
To: pg@fastcrypt.com; +Cc: pgsql-jdbc
Dave Cramer wrote:
>Tim,
>
>Use setBigDecimal
>
>Dave
>
>
Thanks. Missed that one.
Tim
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2004-09-15 12:49 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-15 12:01 Calling functions with numeric parameters Tim Penhey <tim@penhey.net>
2004-09-15 12:36 ` Dave Cramer <pg@fastcrypt.com>
2004-09-15 12:49 ` Tim Penhey <tim@penhey.net>
2004-09-15 12:38 ` Paul Thomas <paul@tmsl.demon.co.uk>
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