Обсуждение: Function Like IsDate in pgSQL

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

Function Like IsDate in pgSQL

От
"Sistemas C.M.P."
Дата:
I'm sorry. I'm from Argentina and my english is very poor.
 
I am converting an aplication from Ms-SQL to postgreSQL with ODBC.
I have a query  that use the IsDate(string)  function (Ms function). This function return true if the argument (string) is a valid date.
I need to implement this function in postgreSQL
can you help me?
 

Re: Function Like IsDate in pgSQL

От
Tom Lane
Дата:
"Sistemas C.M.P." <sistemascmp@redynet4.com.ar> writes:
> I have a query  that use the IsDate(string)  function (Ms function). =
> This function return true if the argument (string) is a valid date.
> I need to implement this function in postgreSQL=20

In PG 8.0 and up this is trivial --- try to cast the string to date and
see if you get an error or not.  Use the BEGIN ... EXCEPTION syntax
to catch the error and return false.

            regards, tom lane