pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
error code invalid_input_syntax
2+ messages / 2 participants
[nested] [flat]

* error code invalid_input_syntax
@ 2006-01-12 00:05  Rainer Leo <leo@workfile.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Rainer Leo @ 2006-01-12 00:05 UTC (permalink / raw)
  To: pgsql-jdbc

I wrote a function which generates SQL statements
for INSERTs and UPDATEs, in which I cast the values
to the correct datatype.

Now I want to catch

ERROR:  invalid input syntax for integer: "i"

but although I tried quite a few I can't find the right
error code for this exception.

Is it possible that this error can not be caught?


Thanks
Leo





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: error code invalid_input_syntax
@ 2006-01-12 21:32  Kris Jurka <books@ejurka.com>
  parent: Rainer Leo <leo@workfile.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2006-01-12 21:32 UTC (permalink / raw)
  To: Rainer Leo <leo@workfile.de>; +Cc: pgsql-jdbc



On Thu, 12 Jan 2006, Rainer Leo wrote:

> I wrote a function which generates SQL statements
> for INSERTs and UPDATEs, in which I cast the values
> to the correct datatype.
>
> ERROR:  invalid input syntax for integer: "i"
>
> but although I tried quite a few I can't find the right
> error code for this exception.
>

You can easily check the error code via SQLException.getSQLState().  A 
quick test in psql will also demonstrate its value.

jurka=# \set VERBOSITY verbose
jurka=# select 'a'::int;
ERROR:  22P02: invalid input syntax for integer: "a"
LOCATION:  pg_atoi, numutils.c:84

Kris Jurka



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-01-12 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-12 00:05 error code invalid_input_syntax Rainer Leo <leo@workfile.de>
2006-01-12 21:32 ` Kris Jurka <books@ejurka.com>

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