Re: a math function with error handling - Mailing list pgsql-general

From Chris Mair
Subject Re: a math function with error handling
Date
Msg-id 1160889062.14610.5.camel@ultra.home.lan
Whole thread Raw
In response to a math function with error handling  (Arthur Molina <arthurmolina@yahoo.com.br>)
List pgsql-general
> If I send something like 25 / '5' I get the result, 5
> but if I send 25 / '0' I get null (division_by_zero)
> or when I send 25 / 'textcrap' I get null too....

You might want to look at pl/pgsql exception handlers:
http://www.postgresql.org/docs/8.1/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

Trapping division by zero is given as an example there...


Bye, Chris.


--

Chris Mair
http://www.1006.org


pgsql-general by date:

Previous
From: Arthur Molina
Date:
Subject: a math function with error handling
Next
From: Ron Johnson
Date:
Subject: Re: A query planner that learns