Home > Archive > PHP with PostgreSQL > October 2005 > Date type in pl/pgsql function checking passed parameter









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Date type in pl/pgsql function checking passed parameter
Partners Majolee Infotech

2005-10-27, 8:15 am

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..
John DeSoi

2005-10-27, 8:15 am


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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com