create or replace function getcurrdate(i_date date)
return date
is
v_date date;
v_datestr varchar2(10);
begin
if i_date is null then
v_date := sysdate;
else
v_date := i_date;
end if;
v_datestr := to_char(v_date,'yyyy-MM-dd');
return getdate(v_datestr);
end getcurrdate;