Re: error code invalid_input_syntax

From: Kris Jurka <books(at)ejurka(dot)com>
To: Rainer Leo <leo(at)workfile(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: error code invalid_input_syntax
Date: 2006-01-12 21:32:34
Message-ID: Pine.BSO.4.61.0601121630100.25024@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2006-01-13 03:19:46 Re: reading an oidvector field error
Previous Message Takeichi Kanzaki Cabrera 2006-01-12 14:29:44 reading an oidvector field error