Thread: Text Description of Current Exception

Text Description of Current Exception

From
"Ward Eaton"
Date:

Hello,

 

I would like to log any exceptions which may be thrown in my database functions.  Oracle has a predefined variable, SQLERRM, which will always have a text description of the current exception.  Is there anything like this available in postgres?

 

Thank you,

Ward Eaton
Project Engineer Automation

RAD-CON Inc.
TECHNOLOGY:
Innovative & Proven
Office: +1.216.706.8927
Fax: +1.216.221.1135
Website: www.RAD-CON.com
E-mail: Ward.Eaton@RAD-CON.com

 

Attachment

Re: Text Description of Current Exception

From
Justin
Date:
Ward Eaton wrote: <blockquote cite="mid:04A6DB42D2BA534FAC77B90562A6A03DD629A9@server.rad-con.local"
type="cite"><style>
<!--/* Font Definitions */@font-face{font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}/* Style Definitions
*/p.MsoNormal,li.MsoNormal, div.MsoNormal{margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New
Roman";}
a:link, span.MsoHyperlink{color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed{color:purple;text-decoration:underline;}
span.EmailStyle17{mso-style-type:personal-compose;font-family:Arial;color:windowtext;}
@page Section1{size:8.5in 11.0in;margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1{page:Section1;}
--> </style><div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt;
font-family:Arial;">Hello,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt;
font-family:Arial;"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt;
font-family:Arial;">I would like to log any exceptions which may be thrown in my database functions.  Oracle has a
predefinedvariable,</span></font><font color="blue" face="Arial"><span style="font-family: Arial; color: blue;">
</span></font><fontface="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">SQLERRM, which will always
havea text description of the current exception.  Is there anything like this available in postgres?</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font><p
class="MsoNormal"style=""><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"><font
color="blue"><spanstyle="color: blue;"><a href="mailto:Ward.Eaton@RAD-CON.com" moz-do-not-send="true"
title="mailto:Michael.Loufman@RAD-CON.com"><span
title="mailto:Michael.Loufman@RAD-CON.com"></span></a></span></font></span></font><fontface="Tahoma" size="2"><span
style="font-size:10pt; font-family: Tahoma;"></span></font></div></blockquote><br /><div class="Section1"><p
class="MsoNormal"><fontface="Times New Roman" size="3"><span style="font-size: 12pt;"><br /></span></font></div> I'm
notsure what you are after.  Your requesting logging the error yet referring to SqlErrm used in exception blocks<br
/><br/> postgresql has SQLSTATE used in  exception catching of errors in a pl/SQL function  see<br /><a
class="moz-txt-link-freetext"
href="http://www.postgresql.org/docs/8.3/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING">http://www.postgresql.org/docs/8.3/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING</a><br
/><br/> Postgresql logs errors in a log file unless it's been turned off.<br /> See configure logging <br /><a
class="moz-txt-link-freetext"
href="http://www.postgresql.org/docs/8.3/interactive/runtime-config-logging.html">http://www.postgresql.org/docs/8.3/interactive/runtime-config-logging.html</a><br
/><br/><br /> These instructions are for 8.3  if you have different version go to this section of the help files for
yourspecific version.<br /><br />