Getting the last_day in a SQL variable

  • From: David Pintor <painterman@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Fri, 10 Jul 2009 12:20:49 +0100

Hi guys,

I'm trying to do a sql script (please see below) but i cant figure out how
to get in a variable the value of the LAST_DAY in a month... any tips?

accept month prompt 'Enter Month [MON]:';
accept year prompt 'Enter Year [YY]:';

def lastday=LAST_DAY(&month);

select count(distinct(ppsn))
from   award_result
where  to_date(date_awarded, 'DD-MON-YY') >= '01-&month-&year'
and    to_date(date_awarded, 'DD-MON-YY') <= '&lastday-&month-&year';



Thanks!!

David

Other related posts: