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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql