Please let me know how to find a leap year through PL/SQL function. Suppose we input any number, how can we find out it is leap year or not?
Try the below function,
FUNCTION leap_year_or_not(
i_year IN NUMBER)
RETURN VARCHAR2
IS
l_var VARCHAR2(20);
BEGIN
IF TO_CHAR(LAST_DAY(TO_DATE('01/02/'||i_year, 'dd/mm/yyyy')), 'DD') = 29 THEN
l_var := 'Leap Year';
ELSE
l_var := 'Not Leap Year';
END IF;
RETURN l_var;
END;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With