Обсуждение: create function atof?

Поиск
Список
Период
Сортировка

create function atof?

От
Mark Tabash
Дата:
Hello,

Is it possible to create a database function that mimics the C function atof?
I'm guessing it should look something like this:
create function atof(varchar) returns floatas '??????'language ????returns null on null input;

Thanks,

Mark


Re: create function atof?

От
Yasir Malik
Дата:
> Is it possible to create a database function that mimics the C function atof?
> I'm guessing it should look something like this:

You can do this to convert a string to a float:
select '3.14'::float + 1;
?column?
----------    4.14
(1 row)

Is that what you want?
Yasir