Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: leap year
Inessa,
How about this. Pretty simple and it works!
declare
start_year number :=3D 1981;
end_year number :=3D 1990;
indx number :=3D start_year;
success_count number :=3D 0;
test_date date;
begin
while indx < end_year loop
begin
select to_date(to_char(indx)||'0229','yyyymmdd') into test_date from dual; dbms_output.put_line(indx || ' ok'); =20 success_count :=3D success_count + 1; exception when others then dbms_output.put_line(indx || ' error'); =20=20
Dbms_Output results
1981 error
1982 error
1983 error
1984 ok
1985 error
1986 error
1987 error
1988 ok
1989 error
success_count =3D 2
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Inessa Weiner
Sent: Tuesday, May 24, 2005 10:01 AM
To: oracle-l_at_freelists.org
Subject: leap year
Hi,
I need to write a PL/SQL function to
show how many times the leap year occurred between two dates.
The maximum range between dates is 10 years.
Please help.
Thanks,
Inessa.=20
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Tue May 24 2005 - 10:21:59 CDT
![]() |
![]() |