From: | Ketema Harris <ketema(at)gmail(dot)com> |
---|---|
To: | "Sistemas C(dot)M(dot)P(dot)" <sistemascmp(at)redynet4(dot)com(dot)ar>, <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: IsDate function in plpgsql |
Date: | 2006-04-27 14:38:56 |
Message-ID: | C0764FC0.2D1A%ketema@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
I think someone will show you a better way, but if all you need to do is
account for the NULLS...
begin
if $1 is null then
return 0;
else
perform $1::date;
return 1;
end if;
exception when others then
return 0;
end
On 4/27/06 10:34 AM, "Sistemas C.M.P." <sistemascmp(at)redynet4(dot)com(dot)ar> wrote:
> A few days ago, someone in this list gives me a function (plpgsql) that
> evaluates if a string is a valid date or not.
> It returns 1 or 0 (valid/Not Valid)
> The problem is that if the argument is a NULL field the function returns 1.
> I don't have experience with plpgsql language.
> This is the function
>
> begin
> perform $1::date;
> return 1;
> exception when others then
> return 0;
> end
>
From | Date | Subject | |
---|---|---|---|
Next Message | Bricklen Anderson | 2006-04-27 14:40:24 | Re: IsDate function in plpgsql |
Previous Message | Sistemas C.M.P. | 2006-04-27 14:34:42 | IsDate function in plpgsql |