如果采用一年365天,一月30天的话可以这样实现
create or replace function getdate(stdate date) return varchar2 is
  Result varchar2(16);
  temp integer;
tyear integer;
tmonth integer;
tday integer;
begin
  select (to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')-stdate)  into temp from dual;
  select trunc(temp/365,0)  into tyear  from dual;
  select trunc(mod (temp,365)/30,0) into tmonth from dual;
  select trunc(mod (temp,30),0) into tday from dual;
  select to_char(tyear)||'-'||to_char(tmonth)||'-'||to_char(tday) into result from dual;
  return(result);
end getdate;