> > What I want is SELECT statement that references no tables but returns
> > the days in a given month.   I'm now thinking that I might be able to
> > come up with something using an IN clause and using EXTRACT, but
> > haven't figured it out yet.

I have a 'last_day' function (duplicating what the equivalent Oracle 
function does), from that you can extract the number of days in the month.

Here's my 'last_day' function:

create or replace function public.last_day(date)
returns date as
'
DECLARE
  this_day alias for $1;
  declare wk_day date;
BEGIN

  wk_day := date_trunc(''month'', this_day) + interval ''1 month''
      - interval ''1 day'';
  return wk_day;
END
' language 'plpgsql';
--
Mike Nolan

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to