create or replace FUNCTION get_fin_yr ( p_date date ) return varchar2
is
v varchar2(100);
begin
null;
if to_char(p_date,'mm') between 7 and 12 then
v:= to_char( p_date,'rrrr') ||'-'|| substr( to_number( to_char( p_date,'rrrr')) +1,-2) ;
else
v:= ( to_number( to_char( p_date,'rrrr')) -1 )|| '-'|| substr( to_number( to_char( p_date,'rrrr')) ,-2) ;
end if;
return v;
end;
No comments:
Post a Comment