CREATE OR REPLACE FUNCTION IS_DATE (text) RETURNS INTEGER AS $$
BEGIN
IF ($1 IS NULL) THEN
RETURN 0;
END IF;
PERFORM $1::date;
RETURN 1;
EXCEPTION WHEN others THEN
RETURN 0;
END;
$$ language plpgsql;
Referensi
- Re: IsDate function in plpgsql, https://www.postgresql.org/message-id/4450D7D8.6050200@presinet.com
No comments:
Post a Comment