Sometimes its best to use simple maths rather than date functions
SQL> create or replace
2 function f1(y number) return boolean is
3 x date;
4 begin
5 x := to_date('2902'||y,'ddmmyyyy');
6 return true;
7 exception
8 when others then return false;
9 end;
10 /
Function created.
SQL> create or replace
2 function f2(y number) return boolean is
3 begin
4 return mod(y,4)=0 and ( mod(y,100) != 0 or mod(y,400) = 0 );
5 end;
6 /
Function created.
SQL> set timing on
SQL> declare
2 l boolean;
3 begin
4 for i in 1 .. 500000 loop
5 l := f1(1234);
6 end loop;
7 end;
8 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:06.96
SQL> declare
2 l boolean;
3 begin
4 for i in 1 .. 500000 loop
5 l := f2(1234);
6 end loop;
7 end;
8 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.39
SQL>