From: | Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk> |
---|---|
To: | Johnny Winn <j(dot)winn(dot)v(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: generated dates from record dates - suggestions |
Date: | 2012-08-22 10:49:53 |
Message-ID: | 201208221149.53634.gary.stainburn@ringways.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tuesday 21 August 2012 13:11:06 Johnny Winn wrote:
> CREATE OR REPLACE FUNCTION get_dates(date, date, date) RETURNS TABLE(date1
> date, date2 date)
> AS $$
> DECLARE
> date_1 DATE := NULL;
> date_2 DATE := NULL;
> BEGIN
>
> -- test your conditions here
>
> RETURN QUERY SELECT date_1::date, date_2::date;
> END;
> $$
> LANGUAGE PLPGSQL;
>
> I hope this helps,
> Johnny
Johnny,
Having gone down the CASE/WHEN route and found it too clumsy I'm now looking
at using this method. I'm just about to start writing the function, but I'm
wondering how I would include this is the select / view .
Gary
--
Gary Stainburn
Group I.T. Manager
Ringways Garages
http://www.ringways.co.uk
From | Date | Subject | |
---|---|---|---|
Next Message | Mubarik, Aiysha | 2012-08-29 19:48:48 | Tablesample Function on Postgres 9.1 |
Previous Message | Gary Stainburn | 2012-08-21 12:15:58 | Re: generated dates from record dates - suggestions |