Re: Can interval take a value from a field?

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Jeff Ross <jross(at)wykids(dot)org>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can interval take a value from a field?
Date: 2008-09-09 23:27:18
Message-ID: 1221002838.13633.6.camel@dell.linuxdev.us.dell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2008-09-09 at 17:03 -0600, Jeff Ross wrote:
> select
> ts_date as "Transcript Date",
> ts_expiration_date as "Current Expiration Date",
> expiration_value as "Expiration Interval"
> from transcript, training_expiration_value where
> ts_training_id = trgexpd_trg_id and
> ts_training_id in (select cda_training_number from cdas) and
> ts_expiration_date != ts_date + interval 'expiration_value';
>
> and I'm getting the following error:
>
> ERROR: invalid input syntax for type interval: "expiration_value"

This error is saying that it is trying to convert the string
'expiration_value' to an interval.

What you really want it to convert the string value held inside a
variable named "expiration_value" to an interval.

For that, you need to do expiration_value::interval

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Weber 2008-09-09 23:43:24 OSX build of PostgreSQL 8.3.3 with macports
Previous Message Jerry LeVan 2008-09-09 23:27:14 Re: OS X library path issues for libpq (ver 8.3