2017-08-28 37 views
0

我正在将ms SQL服务器查询转换为Greenplum数据库的Postgres SQL,在Greenplum/postgres中是否有任何等效的ISDATE()函数?greenplum中的ISDATE()等价函数

+1

https://stackoverflow.com/questions/25374707/check-whether-string-is-a-date-postgresql –

回答

0

要回答你的问题,在postgres或greenplum中没有这样的功能。

但您可以创建自定义功能。看到它下面

create or replace function is_date(s varchar) returns boolean as $$ 
begin 
    perform s::date; 
    return true; 
exception when others then 
    return false; 
end; 
$$ language plpgsql; 

有关详细信息,请参阅 Check whether string is a date Postgresql