You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
436 B
20 lines
436 B
-- Convert string to date
|
|
--
|
|
CREATE OR REPLACE FUNCTION CDB_StringToDate(input character varying)
|
|
RETURNS TIMESTAMP AS $$
|
|
DECLARE output TIMESTAMP;
|
|
BEGIN
|
|
BEGIN
|
|
output := input::date;
|
|
EXCEPTION WHEN OTHERS THEN
|
|
BEGIN
|
|
SELECT to_timestamp(input::integer) INTO output;
|
|
EXCEPTION WHEN OTHERS THEN
|
|
RETURN NULL;
|
|
END;
|
|
END;
|
|
RETURN output;
|
|
END;
|
|
$$
|
|
LANGUAGE 'plpgsql' STABLE STRICT;
|