Search Postgresql Archives

Re: help w/ SRF function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-09-19 at 07:57 +0200, A. Kretschmer wrote:
> am  Mon, dem 17.09.2007, um  9:21:22 +0800 mailte Ow Mun Heng folgendes:
> > CREATE OR REPLACE FUNCTION foo_func(fromdate timestamp, todate
> > timestamp, code text)
> >   RETURNS SETOF foo AS
> > $BODY$
> > 	SELECT
> > 	TRH.ID,
> > 	TRH.data1,
> > 	TRH.data2,
> > 	FROM D 
> > 	INNER JOIN  TS 
> > 	     ON TS.id = D.id
> > 	inner join TRH
> > 	     on ts.id = trh.id
> > 	WHERE D.start_timestamp BETWEEN fromdate AND todate
> > 	And D.code IN (code)
> > $BODY$
> > LANGUAGE 'sql' IMMUTABLE STRICT;
> > 
> > How can I go about this this? The above will fail due to missing columns
> > fromdate/todate/code.
> 
> Use $1, 2 and $3 within the function-body instead fromdate, todate and
> code.


Yep.. that works as advertised. 

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux