a math function with error handling

Поиск
Список
Период
Сортировка
От Arthur Molina
Тема a math function with error handling
Дата
Msg-id 4531BC1E.4040209@yahoo.com.br
обсуждение исходный текст
Ответы Re: a math function with error handling  (Chris Mair <chrisnospam@1006.org>)
Список 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/



В списке pgsql-general по дате отправления:

Предыдущее
От: "Guy Rouillier"
Дата:
Сообщение: Re: A query planner that learns
Следующее
От: Chris Mair
Дата:
Сообщение: Re: a math function with error handling