Re: hi,function for checking leap

Re: hi,function for checking leap

 

  


The decode statement should have been:

Decode(TO_NUMBER(TO_CHAR(LAST_DAY(to_date('02/01/'||to_char(p_Date,'RRRR'),'
MM/DD/RRRR')),'DD')),29,1,0)

Regards,
Krishna


----- Original Message -----
From: <[Email Address Removed] "LazyDBA.com Discussion" <[Email Address Removed] Monday, December 30, 2002 01:08 AM
Subject: RE: hi,function for checking leap


> Wrote file afiedt.buf
>
> 1 Create Or Replace Function IsLeapYear(p_Date Date Default Sysdate)
Return Number
> 2 As
> 3 retVal Number;
> 4 Begin
> 5 Select Decode(TO_NUMBER(TO_CHAR(LAST_DAY(Sysdate),'DD')),29,1,0)
Into Retval From Dual;
> 6 Return retVal;
> 7* End;
> SQL> /
>
> Function created.
>
> SQL> select IsLeapYear(Sysdate) from dual;
>
> ISLEAPYEAR(SYSDATE)
> -------------------
> 0
>
> SQL>
>
>
> HTH
>
> Regards,
> Ganesh R
>
>


----------------------------------------------------------------------------
----


> --------
> Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
> To unsubscribe: send a blank email to oracledba-[Email Address Removed] To subscribe: send a blank email to oracledba-[Email Address Removed] Visit the list archive: http://www.LAZYDBA.com/odbareadmail.pl
> Tell yer mates about http://www.farAwayJobs.com
> By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page