Re: IsDate function in plpgsql
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: IsDate function in plpgsql
- From: Ketema Harris <ketema@xxxxxxxxx>
- Date: Thu, 27 Apr 2006 10:38:56 -0400
- In-reply-to: <006501c66a07$b8c08d60$0501a8c0@pcsistemas>
- Thread-index: AcZqCE/vjsApM9X7Edqi1AARJHlfcA==
- Thread-topic: [ADMIN] IsDate function in plpgsql
- User-agent: Microsoft-Entourage/11.2.3.060209
Title: Re: [ADMIN] IsDate function in plpgsql
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@xxxxxxxxxxxxxxx> 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
[Index of Archives]
[KVM ARM]
[KVM ia64]
[KVM ppc]
[Virtualization Tools]
[Spice Development]
[Libvirt]
[Libvirt Users]
[Linux USB Devel]
[Linux Audio Users]
[Yosemite Questions]
[Linux Kernel]
[Linux SCSI]
[XFree86]