Try using EXECUTE.
http://www.postgresql.org/docs/7.4/static/plpgsql-
statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Oct 2
Thanks! Now I get it...
naeem
-Original Message-
From: Oliver Elphick [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 26, 2004 3:05 PM
To: Naeem Bari
Cc: [EMAIL PROTECTED]
Subject: Re: [GENERAL] Newbie question about escaping in a function
On Tue, 2004-10-26 at 11:57 -0500, Naeem
On Tue, 2004-10-26 at 11:57 -0500, Naeem Bari wrote:
> I have a simple function defined thusly:
>
>
>
> CREATE OR REPLACE FUNCTION datemath(timestamp with time zone, int4,
> varchar)
>
> RETURNS timestamp AS
>
> '
>
> DECLARE
>
> tdat timestamp;
>
> rdat timestamp;
>
> BEGIN
>
>
I have a simple function defined thusly:
CREATE OR REPLACE FUNCTION datemath(timestamp with time
zone, int4, varchar)
RETURNS timestamp AS
'
DECLARE
tdat timestamp;
rdat timestamp;
BEGIN
IF ($1 IS NULL) THEN
TDAT
:= NOW();
ELSE
TDAT
:= $1;
END IF;
se