Oracle之:Function :getdate()
create or replace function getdate(sp_date varchar) return date is
  Result date;
begin

  if LENGTH(sp_date) =10 then
    Result:=to_date(sp_date,'YYYY-MM-dd');
  end if;

  if LENGTH(sp_date) =8 then
    Result:=to_date(sp_date,'YYYYMMdd');
  end if;


  return(Result);
end getdate;

posted on 2017-08-14 11:03  Holyz  阅读(1671)  评论(0编辑  收藏  举报