create procedure lib_date_leap_year (
ofyear smallint)
returns (
is_leap_year smallint)
as
begin
/*
check year for leap year
is_leap_year : 0 = false
1 = true
*/
if (ofyear is null)
then
is_leap_year = null;
else
if ( extract( yearday from cast( ofyear || '-3-1' as date))
< 60)
then
is_leap_year = 0;
else
is_leap_year = 1;
suspend;
end