Date type in pl/pgsql function checking passed parameter

Date type in pl/pgsql function checking passed parameter

am 24.10.2005 15:02:10 von Majolee InfoTech

This is a multi-part message in MIME format.

------=_NextPart_000_009D_01C5D8C9.3EDB9050
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello All,

We have a pl/pgsql function functionName(date) .. here if it has been =
called using functionName('23456') it gives error .. we need to raise an =
exception(customized error message) if the passed value is not date.. =
how can we do that.

Thanks..
------=_NextPart_000_009D_01C5D8C9.3EDB9050
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable





12:00:00 GMT">




charset=3Diso-8859-1">




Hello All,

 

We have a pl/pgsql function =
functionName(date) ..=20
here if it has been called using functionName('23456') it gives error .. =
we need=20
to raise an exception(customized error message) if the passed value is =
not=20
date.. how can we do that.

 

Thanks..




href=3D"http://165845.sigclick.mailinfo.com/sigclick/0104050 9/00024E00/05=
4E0220201472.jpg"> src=3D"http://165845.signature1.mailinfo.com/confirm2.5/0104 0509/00024E00=
/054E0220201472.jpg" border=3D"0" nosend=3D"1">


style=3D"font-family=3DVerdana;font-size=3D11px;">Make sure YOUR emails =
don't get lost! Download Mailinfo here =

=00
------=_NextPart_000_009D_01C5D8C9.3EDB9050--

Re: Date type in pl/pgsql function checking passed parameter

am 24.10.2005 16:11:00 von John DeSoi

On Oct 24, 2005, at 9:02 AM, Partners Majolee Infotech wrote:

> We have a pl/pgsql function functionName(date) .. here if it has
> been called using functionName('23456') it gives error .. we need
> to raise an exception(customized error message) if the passed value
> is not date.. how can we do that.


You can add a function with the same name that accepts a text
parameter instead of a date. Then check the date and call your
functionName(date) function or raise your custom exception if the
date is invalid.



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly