Re: Adding an INTERVAL to a variable

From: "Graham Coates" <graham(at)mindvision(dot)com(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Adding an INTERVAL to a variable
Date: 2001-08-09 07:17:01
Message-ID: 9ktddf$134e$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks for the inspiration Vivek!
Didn't quite work, but when I made it...
dSalesHdrDateDue + (iAcctPayDaysAv || 'Days')::INTERVAL

BINGO! it works.
Happiness is :-)

Graham Coates

"Vivek Khera" <khera(at)kcilink(dot)com> wrote in message
news:x73d737w54(dot)fsf(at)onceler(dot)kciLink(dot)com(dot)(dot)(dot)
> >>>>> "GC" == Graham Coates <graham(at)mindvision(dot)com(dot)au> writes:
>
> GC> SELECT Invoices.InvoiceDate + INTERVAL '41 Days'
> GC> works fine
> GC> but when trying to substitute the number of days with a value form a
field
> GC> e.g.
>
> GC> SELECT Invoices.InvoiceDate + INTERVAL Acct.AverageDaysToPay 'Days'
>
> try
>
> SELECT Invoices.InvoiceDate + Acct.AverageDaysToPay::interval
>
>
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Vivek Khera, Ph.D. Khera Communications, Inc.
> Internet: khera(at)kciLink(dot)com Rockville, MD +1-240-453-8497
> AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-08-09 13:55:55 Re: what does this error mean?
Previous Message Carolyn Lu Wong 2001-08-09 06:18:27 what does this error mean?