Date type in pl/pgsql function checking passed parameter

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


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"EXPIRES" CONTENT=3D"0">
<META HTTP-EQUIV=3D"EXPIRESABSOLUTE" CONTENT=3D"Tue, 01 Jun 1999 =
12:00:00 GMT">
<META HTTP-EQUIV=3D"PRAGMA" CONTENT=3D"NO-CACHE">
<META HTTP-EQUIV=3D"CACHE-CONTROL" CONTENT=3D"PRIVATE">
<META HTTP-EQUIV=3D"CACHE-CONTROL" CONTENT=3D"NO-CACHE">

<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello All,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>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.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks..</FONT></DIV>
<!--4653504C785C-->
<br><br><a =
href=3D"http://165845.sigclick.mailinfo.com/sigclick/0104050 9/00024E00/05=
4E0220201472.jpg"><img =
src=3D"http://165845.signature1.mailinfo.com/confirm2.5/0104 0509/00024E00=
/054E0220201472.jpg" border=3D"0" nosend=3D"1"></a>
<br><A HREF=3D"http://www.mailinfo.com/web/?uid=3D165845" =
style=3D"font-family=3DVerdana;font-size=3D11px;">Make sure YOUR emails =
don't get lost!<b> Download Mailinfo here<b> =
</A><!--4653504C785C//--></BODY></HTML>
=00
------=_NextPart_000_009D_01C5D8C9.3EDB9050--
Majolee InfoTech [ Mo, 24 Oktober 2005 15:02 ] [ ID #1027149 ]

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

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 [at] postgresql.org so that your
message can get through to the mailing list cleanly
John DeSoi [ Mo, 24 Oktober 2005 16:11 ] [ ID #1027150 ]
Datenbanken » gmane.comp.db.postgresql.php » Date type in pl/pgsql function checking passed parameter

Vorheriges Thema: copy error
Nächstes Thema: phpPgAdmin 3.5.6 Released