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
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
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера