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 [email protected]
Whole thread Raw
In response to a math function with error handling  (Arthur Molina <[email protected]>)
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