| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: leap year
Please consider this and add extra logic, if necessary.
CREATE OR REPLACE FUNCTION cl (
dfrom DATE , dto DATE
ln NUMBER := 0;BEGIN
ln := ln
+ CASE
WHEN MOD(i, 4) = 0
AND NOT ((MOD(i, 100) = 0) AND (MOD(i, 400) > 0))
THEN 1
ELSE 0
END;
SQL> VAR c NUMBER
SQL> EXEC :c := cl(TO_DATE('11.27.1976', 'MM.DD.YYYY'), SYSDATE);
SQL> PRINT c
C
----------
8
-- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle. -- http://www.freelists.org/webpage/oracle-lReceived on Wed May 25 2005 - 00:38:13 CDT
![]() |
![]() |