From: | Arthur Molina <arthurmolina(at)yahoo(dot)com(dot)br> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | a math function with error handling |
Date: | 2006-10-15 04:42:06 |
Message-ID: | 4531BC1E.4040209@yahoo.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi there,
I am new in this group and I've been working a lot in this function
but it didnt work good enought until now. Here is the thing: I use some
sql strings that calcultes a coll with another and I get the results.
For exemple I have two tables that has many float, texts or numeric colls.
Like Tab01 with V01 as varchar(10), V02 as numeric, V03 as float; and
Tab02 with F01 as varchar(20), F02 as float, F03 as float, F04 as
numeric. In the colls of varchar there will be times that there is a
number and others not.
There will be times that I will need to do a sum or division or any
other math. Just like this:
SELECT Tab01.V01 + Tab02.F03 FROM Tab01, Tab02
SELECT Tab01.V02 / Tab02.F01 FROM Tab01, Tab02
Well here is the thing, I get some errors by doing this because we can
have any results. So I need a function that tests this like:
evalthis(Tab01.V02 / Tab02.F01);
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....
Is there any chance to get something like this?
sorry for my bad English
regards,
Arthur
_______________________________________________________
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
http://br.mobile.yahoo.com/mailalertas/
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Mair | 2006-10-15 05:11:02 | Re: a math function with error handling |
Previous Message | Guy Rouillier | 2006-10-15 04:17:12 | Re: A query planner that learns |