dbTalk Databases Forums  

SQL state /

comp.databases.postgresql comp.databases.postgresql


Discuss SQL state / in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dog is love
 
Posts: n/a

Default SQL state / - 04-26-2011 , 08:28 AM






Hi,

I was trying to trap the SQL States as listed in

http://www.postgresql.org/docs/8.2/s...-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 do not want to test the error code, I only want to pass it back to a
JAVA front end.

Reply With Quote
  #2  
Old   
Jasen Betts
 
Posts: n/a

Default Re: SQL state / - 04-30-2011 , 05:54 AM






On 2011-04-26, Dog is love <michaelnewportyahoo.com (AT) gmail (DOT) com> wrote:
Quote:
Hi,

I was trying to trap the SQL States as listed in

http://www.postgresql.org/docs/8.2/s...-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

Quote:
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

Reply With Quote
  #3  
Old   
M. Strobel
 
Posts: n/a

Default Re: SQL state / - 04-30-2011 , 11:00 AM



Am 26.04.2011 15:28, schrieb Dog is love:
Quote:
Hi,

I was trying to trap the SQL States as listed in

http://www.postgresql.org/docs/8.2/s...-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 do not want to test the error code, I only want to pass it back to a
JAVA front end.
I can tell you I can't trap any errors in pltcl, the error is
reflected to the client.

/Str.

Reply With Quote
  #4  
Old   
M. Strobel
 
Posts: n/a

Default Re: SQL state / - 05-04-2011 , 03:21 AM



Am 30.04.2011 18:00, schrieb M. Strobel:
Quote:
Am 26.04.2011 15:28, schrieb Dog is love:
Hi,

I was trying to trap the SQL States as listed in

http://www.postgresql.org/docs/8.2/s...-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 do not want to test the error code, I only want to pass it back to a
JAVA front end.

I can tell you I can't trap any errors in pltcl, the error is
reflected to the client.

/Str.
Corrected:

in pltcl I can catch errors, and I get the error messsage as text.

I still can not find the sql state anywhere.

/Str.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.