By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 3,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

Invalid input syntax for type date

P: 4
I have written this function:


CREATE OR REPLACE FUNCTION get_date2(idate date) RETURNS date AS $$
DECLARE
tmp text;

BEGIN
SELECT to_char(idate, 'FMDDth FMMon YYYY') into tmp;
return tmp::date;
END;

$$ LANGUAGE 'plpgsql';

But when I try to use the function I get this error:

my_dbs=#select get_date2('01/02/1989');
ERROR: invalid input syntax for type date: "1st Feb 1989"
CONTEXT: PL/pgSQL function "get_date2" line 6 at RETURN

any help will be appreciated
Sep 20 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.