Re: a math function with error handling

From: Chris Mair <chrisnospam(at)1006(dot)org>
To: Arthur Molina <arthurmolina(at)yahoo(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: a math function with error handling
Date: 2006-10-15 05:11:02
Message-ID: 1160889062.14610.5.camel@ultra.home.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2006-10-15 05:48:41 Re: A query planner that learns
Previous Message Arthur Molina 2006-10-15 04:42:06 a math function with error handling