by 병기태 [SQL Query] ORA-01861 ORACLE JDBC CentOS Data Format [2018.03.28 16:41:21]
안녕하세요. 개월 수 차이를 구하는 간단한(?) 구문에서 에러가 발생하여 질문글을 올리게되었습니다.ㅠㅠ
1 2 | SELECT TRUNC(MONTHS_BETWEEN(TO_DATE(NVL( '201802' ,TO_CHAR(ADD_MONTHS(SYSDATE,-1), 'YYYYMM' )), 'YYYYMM' ), TRUNC(TO_DATE( '2018-03-28' ), 'MM' ))) FROM DUAL |
위와 같은 입력1('YYYYMM'), 입력2('YYYY-MM-DD')의 개월 수 차이를 구하는 쿼리를 JDBC(ibatis)로 실행하는데요.
로컬환경(Window)과 DBMS로 위 구문을 실행하면 잘되는데 서버(CentOS)에서 실행하면
1 2 3 4 5 6 7 8 | e.getMessage() : SqlMapClient operation; SQL []; --- The error occurred while applying a parameter map. --- Check the statement (update failed). --- Cause: java.sql.SQLDataException: <span style="color:#a52a2a"><strong>ORA-01861: literal does not match format string</strong></span> ; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred while applying a parameter map. --- Check the statement (update failed). --- Cause: java.sql.SQLDataException: <strong><span style="color:#b22222">ORA-01861: literal does not match format string</span></strong> |
ORA-01861이라는 데이터 타입 오류라고 에러를 뱉어냅니다.
jdk버전도 같고 사용하는 DB서버와 오라클버전, 계정까지 모두 같은데 왜 실서버에서 실행하는 저런오류가 나올까요? ㅠㅠ
혹시 의심가는부분 있으면 조언 부탁드립니다!!