Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #101
| From | Jasen Betts <jasen@xnet.co.nz> |
|---|---|
| Newsgroups | comp.databases.postgresql |
| Subject | Re: SQL state / |
| Date | 2011-04-30 10:54 +0000 |
| Organization | Dis (not Dat) Organisation |
| Message-ID | <ipgpoe$r91$1@reversiblemaps.ath.cx> (permalink) |
| References | <be953af4-d251-4de9-b405-f5bc7b44c11c@hg8g2000vbb.googlegroups.com> |
On 2011-04-26, Dog is love <michaelnewportyahoo.com@gmail.com> wrote: > Hi, > > I was trying to trap the SQL States as listed in > > http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html > > in a normal pg/plsql script but I can't seem to do it....is it only > possible to do this in Embedded SQL ? I think you need to use the keyword in plpgsql. in plpgsql I think you need to use the constants like this: EXCEPTION WHEN io_error OR undefined_file THEN > I do not want to test the error code, I only want to pass it back to a > JAVA front end. postgres should pass the error code to the client automatically if the error is not trapped. I don't know how JAVA represents SQL errors. In python I get an exception object containing. among other things the SQL error code. eg: if I do "select 1/0;" I get an exception raised and "22012" (which means dizision by zero) as the error code -- ⚂⚃ 100% natural
Back to comp.databases.postgresql | Previous | Next — Previous in thread | Next in thread | Find similar
SQL state / Dog is love <michaelnewportyahoo.com@gmail.com> - 2011-04-26 06:28 -0700
Re: SQL state / Jasen Betts <jasen@xnet.co.nz> - 2011-04-30 10:54 +0000
Re: SQL state / "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2011-04-30 18:00 +0200
Re: SQL state / "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2011-05-04 10:21 +0200
csiph-web