Getting the last_day in a SQL variable

From: David Pintor <painterman_at_gmail.com>
Date: Fri, 10 Jul 2009 12:20:49 +0100
Message-ID: <f7321f200907100420m55a81b1cxc0437b3aea3db04e_at_mail.gmail.com>



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

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Jul 10 2009 - 06:20:49 CDT

Original text of this message