Re: Trying to select records via matching timestamptz with

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: ben wilko <wilko_ben(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Trying to select records via matching timestamptz with
Date: 2006-08-09 00:35:53
Message-ID: 20060808173433.W88560@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Wed, 9 Aug 2006, ben wilko wrote:

>
> Hi Guys
>
> Trying to select records via matching timestamptz with varchar parameters in postgres 8.1, using the 8.1-404 JDBC3 driver.
> We're also running Java 1.5.0-05.
>
> CREATE OR REPLACE FUNCTION return_daily_card_list(d "varchar", m "varchar", y "varchar")
> RETURNS refcursor AS
> $BODY$
> declare
> pointer refcursor;
> begin
> open pointer for
> select *
> from daily_time_record
> where
> if
> d = SELECT EXTRACT(YEAR FROM daily_time_record.daily_time_card_date)
> and
> m = SELECT EXTRACT(MONTH FROM daily_time_record.daily_time_card_date)
> and
> y = SELECT EXTRACT(DAY FROM daily_time_record.daily_time_card_date)
> and if;

I think you want something like:

open pointer for
select *
from daily_time_record
where
d = EXTRACT(YEAR FROM daily_time_record.daily_time_card_date)
and
m = EXTRACT(MONTH FROM daily_time_record.daily_time_card_date)
and
y = EXTRACT(DAY FROM daily_time_record.daily_time_card_date);

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ramon Orticio 2006-08-09 03:39:54 pgadminIII in fedora core 4 : ident authentication failed
Previous Message ben wilko 2006-08-09 00:12:50 Trying to select records via matching timestamptz with varchar parameters