Re: [SQL] intervals

2011-11-03 Thread Michael Glaesemann
On Nov 3, 2011, at 13:43, bricklen wrote: > On Thu, Nov 3, 2011 at 10:29 AM, Edward W. Rouse > wrote: >> expire := '% days'::interval, limit; > > A couple ways spring to mind immediately. Using 10 as the example: > > expire := 10 * '1 day'::INTERVAL; good. > expire := ('10' || ' days')::IN

Re: [SQL] intervals

2011-11-03 Thread Edward W. Rouse
In conjunction with Jonathan, this has gotten me to the point where it works, sort of. Now I just need to change it so that it does more than 1 at a time. Since it currently isn't in a loop, it affects one and quits. But I needed to get it to do that first, putting it in a loop should be the eas

Re: [SQL] intervals

2011-11-03 Thread Edward W. Rouse
That was part of the problem. Thanks for the info. > -Original Message- > From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql- > ow...@postgresql.org] On Behalf Of Jonathan S. Katz > Sent: Thursday, November 03, 2011 1:41 PM > To: Edward W. Rouse > Cc: pgsql-sql@postgresql.org > Subject

Re: [SQL] intervals

2011-11-03 Thread Jonathan S. Katz
Hi Edward, "LIMIT" is a keyword, which is where you are getting your errors. Did you try a different variable name? Best, Jonathan On Nov 3, 2011, at 1:29 PM, Edward W. Rouse wrote: > I am writing a procedure and am having a little difficulty with an interval. > In the DECLARE section I have

Re: [SQL] intervals

2011-11-03 Thread bricklen
On Thu, Nov 3, 2011 at 10:29 AM, Edward W. Rouse wrote: > expire := '%  days'::interval, limit; A couple ways spring to mind immediately. Using 10 as the example: expire := 10 * '1 day'::INTERVAL; expire := ('10' || ' days')::INTERVAL; -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.o

[SQL] intervals

2011-11-03 Thread Edward W. Rouse
I am writing a procedure and am having a little difficulty with an interval. In the DECLARE section I have: expire interval := '30 days'::interval; which seems to work fine. In the BEGIN block I need to pull out the number of days from a table and update the expire interval to that. But I can't q