create or replace function func_ensure_excel_date(
in_str in varchar2)
return varchar2 as
v_rst varchar2(500) := '';
-- 将excel的数字天数转换为字符串
begin
if instr(in_str, '-') > 0 then
return in_str;
end if;
if instr(in_str, '/') > 0 then
return in_str;
end if;
v_rst := to_char( TO_DATE('19000101','YYYYMMDD') - 2 + to_number(in_str) , 'yyyy-mm-dd hh24:mi:ss' );
return v_rst;
exception
when others then
dbms_output.put_line('code:' || sqlcode);
dbms_output.put_line('lineno:' || dbms_utility.format_error_backtrace);
v_rst := 'err';
return v_rst;
end;