系统日期格式引起的错误:出生日期不能为将来日期

问题描述:

     人员基本信息导入程序中,如果出生日期为1950年以前,系统报错:

           创建员工基本信息失败,请和系统管理员联系
           sqlcode is :-20001
           sqlerrm is :ORA-20001: 出生日期不能为将来日期。

分析:
           经过跟踪发现,出生日期在导入到系统的时候被转换为20xx年了。
           比如:1949-01-01转换後变为2049-01-01
中间结果为:01-1月-49.

date_of_birth                 =trim(date_of_birth         ),--出生日期 是这个函数引起的错误。

--TO_DATE()

日期格式:xx-x月-xx     丢失了年份前两位信息,再转换成4位年的时候是按照xx50年为分界线的。xx50年以前,转换後为:20xx,50以后转换为19xx。

1950年以前的日期,经过转换後变为20xx年,1950年以后的转换为19xx。

结果:这个是系统日期格式引起的错误。

CAS_hrms_interface_api.hr_change_session_date_format;这个函数可以解决这个问题。他把系统时间格式调整为 标准格式:dd-mm-yyyy.

------------------------------------------------------------------------------------------------------

确认是update hr_employee_interface语句或者trim函数引起的问题。解决办法是注释掉这个update 语句。

update hr_employee_interface
    set
    hire_date                    =trim(hire_date            ),--进入本单位时间
    last_name                    =trim(last_name            ),--姓名中文名
    sex                          =trim(sex                  ),--性别
    person_type_id               =trim(person_type_id          ),--人员类型
    national_identifier          =trim(national_identifier ),--身份证
    date_of_birth                =trim(date_of_birth        ),--出生日期
    town_of_birth                =trim(town_of_birth        ),--祖籍

    。。。 。。。


    attribute6                    =trim(attribute6                  ),--分配信息_级别
    attribute7                    =trim(attribute7                  ),--分配信息_工资单
    attribute8                    =trim(attribute8                  ),--分配信息_状态
    attribute9                    =trim(attribute9                  ),--分配信息_雇主
    attribute10                   =trim(attribute10                  ),--分配信息_纳税地区
    per_information1              =trim(per_information1             );--分配信息_社保PHF摊缴地区
    COMMIT;


使用hr_employee_api.create_employee遇到此问题。

 select * from v$parameter t where t.name = 'nls_date_format'


查看客户端的日期格式。

         

            成长

       /      |     \

    学习   总结   分享

QQ交流群:122230156

原文地址:https://www.cnblogs.com/benio/p/1897521.html