Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 05CD39F9FB2 for ; Tue, 19 Dec 2006 17:02:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 28082-01 for ; Tue, 19 Dec 2006 17:02:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from itspmx2.state.ms.us (itspmx2.state.ms.us [205.144.224.112]) by postgresql.org (Postfix) with ESMTP id 668D99F9C35 for ; Tue, 19 Dec 2006 17:02:29 -0400 (AST) Received: from rray.drdc.mstc.ms.gov ([10.3.192.2]) by itspmx2.state.ms.us (8.13.4/8.13.4) with ESMTP id kBJL2MPG023098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 19 Dec 2006 15:02:28 -0600 (CST) Received: from rray.drdc.mstc.ms.gov (localhost.localdomain [127.0.0.1]) by rray.drdc.mstc.ms.gov (8.13.6/8.13.6) with ESMTP id kBJL2MN6015910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 19 Dec 2006 15:02:22 -0600 Received: from localhost (rray@localhost) by rray.drdc.mstc.ms.gov (8.13.6/8.13.6/Submit) with ESMTP id kBJL2MjU015907 for ; Tue, 19 Dec 2006 15:02:22 -0600 X-Authentication-Warning: rray.drdc.mstc.ms.gov: rray owned process doing -bs Date: Tue, 19 Dec 2006 15:02:22 -0600 (CST) From: Richard Ray X-X-Sender: rray@rray.drdc.mstc.ms.gov To: pgsql-sql@postgresql.org Subject: Re: Help with quotes in plpgsql In-Reply-To: <8C5B026B51B6854CBE88121DBF097A866A48FD@ehost010-33.exch010.intermedia.net> Message-ID: References: <8C5B026B51B6854CBE88121DBF097A866A48FD@ehost010-33.exch010.intermedia.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/145 X-Sequence-Number: 27101 On Tue, 19 Dec 2006, Hector Villarreal wrote: > Hi Not sure about $1 parms : you may need to use a variable to set $1 to > then cast it as interval : > > > > > > create or replace function test(integer) returns setof text as $$ > > declare > > a record; > > begin > > select into a now() - ($1::text||'days')::interval; > > return next a; > > return; > > end > > $$ language 'plpgsql'; > This works quite well I never looked at it that way Thanks > > > -----Original Message----- > From: pgsql-sql-owner@postgresql.org > [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Richard Ray > Sent: Tuesday, December 19, 2006 12:10 PM > To: pgsql-sql@postgresql.org > Subject: [SQL] Help with quotes in plpgsql > > > > How should this be properly quoted > > > > create or replace function test(integer) returns setof text as $$ > > declare > > a record; > > begin > > select into a now() - interval '$1 day'; > > return next a; > > return; > > end > > $$ language 'plpgsql'; > > > > I'm not having a lot of luck > > Thanks > > Richard > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 7: You can help support the PostgreSQL project by donating at > > > > http://www.postgresql.org/about/donate > >