pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
calling EXECUTE on any exception
3+ messages / 2 participants
[nested] [flat]

* calling EXECUTE on any exception
@ 2005-07-29 13:36  gherzig@fmed.uba.ar
  0 siblings, 1 reply; 3+ messages in thread

From: gherzig@fmed.uba.ar @ 2005-07-29 13:36 UTC (permalink / raw)
  To: pgsql-sql

Hi all: I want to call some FUNCTION , let say
exception_hanler(Exception_code) for any exception in plsql functions. I
give some pseudo code to explain myself better:

CREATE FUNCION something(...) returns ...
AS
'
...

EXCEPTION
  WHEN OTHER THEN
    EXECUTE exception_handler(Exception_code)
...
'

and let exception_handler() function make all the work and returns some
value for mi program...Now, the actual question...how do i get that
error_code (or code_name, whatever i can get) generated in the something()
function to be proccesed by the exception_handler() function?

Im talking of 8.0 plsql language by the way.

Thanks in advance!
-- 
Gerardo Herzig
Direccion General de Organizacion y Sistemas
Facultad de Medicina

U.B.A.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: calling EXECUTE on any exception
@ 2005-07-29 14:45  Michael Fuhr <mike@fuhr.org>
  parent: gherzig@fmed.uba.ar
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Fuhr @ 2005-07-29 14:45 UTC (permalink / raw)
  To: gherzig@fmed.uba.ar; +Cc: pgsql-sql

On Fri, Jul 29, 2005 at 10:36:52AM -0300, gherzig@fmed.uba.ar wrote:
> EXCEPTION
>   WHEN OTHER THEN
>     EXECUTE exception_handler(Exception_code)
>
> how do i get that error_code (or code_name, whatever i can get)
> generated in the something() function to be proccesed by the
> exception_handler() function?

I don't think you can do this in released versions of PostgreSQL.
In 8.1 you'll be able to use SQLSTATE to get the error code and
SQLERRM to get the error message.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: calling EXECUTE on any exception
@ 2005-07-29 15:59  gherzig@fmed.uba.ar
  parent: Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 3+ messages in thread

From: gherzig@fmed.uba.ar @ 2005-07-29 15:59 UTC (permalink / raw)
  To: pgsql-sql

Oh...to bad...Thank you Michael!
Did someone know if it can be acomplished in pypgsql?

Thanks againg falks.
Gerardo
> On Fri, Jul 29, 2005 at 10:36:52AM -0300, gherzig@fmed.uba.ar wrote:
>> EXCEPTION
>>   WHEN OTHER THEN
>>     EXECUTE exception_handler(Exception_code)
>>
>> how do i get that error_code (or code_name, whatever i can get)
>> generated in the something() function to be proccesed by the
>> exception_handler() function?
>
> I don't think you can do this in released versions of PostgreSQL.
> In 8.1 you'll be able to use SQLSTATE to get the error code and
> SQLERRM to get the error message.
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
>





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-07-29 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-29 13:36 calling EXECUTE on any exception gherzig@fmed.uba.ar
2005-07-29 14:45 ` Michael Fuhr <mike@fuhr.org>
2005-07-29 15:59   ` gherzig@fmed.uba.ar

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox