Accessing function parameters within double quotes

From: "John Duffy" <jbduffy(at)ntlworld(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Accessing function parameters within double quotes
Date: 2003-03-20 16:03:50
Message-ID: 000601c2eefa$595c4890$6690fc3e@devel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

No matter what value of parameter I call the function below with, the value of $2 is always 2 within the addition operation. Is $2 inaccessible within the double quotes? If so how do I amend the function to get it to work?

CREATE FUNCTION get_data(DATE, INTEGER) RETURNS SETOF data AS '
DECLARE
row data%ROWTYPE;
BEGIN
FOR row IN
SELECT * FROM data
WHERE startdate >= $1
AND startdate <= $1 + interval ''$2 months''
LOOP
RETURN NEXT row;
END LOOP;
END;
' LANGUAGE 'plpgsql';

Regards

John Duffy

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar<shridhar_daithankar@persistent.co.in> 2003-03-20 16:06:53 Extracting time from timestamp
Previous Message Frederic S 2003-03-20 16:02:48 Problems with deleting data.