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 [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to