ORA-01861: literal does not match format string

오렌지에서는 정상적으로 실행되는데 서버올려놓고 실행하면 발생하는 문제
java.sql.SQLException: ORA-01861: literal does not match format string

to_char(add_months(pln_horizon_str_dt,1),’YYYY’)

to_char, to_date를 사용할 때, 두번 째 인자값을 명시하지 않으면
DBMS의 NLS_DATE_FORMAT 값에 따라 위의 에러가 갑툭튀 한다고 한다.

그래서 쿼리를 아래와 같이 변경했더니 제대로 돌아간다.
to_char(add_months(to_date(pln_horizon_str_dt,’yyyymmdd’),1),’YYYY’)

Leave a Reply

Your email address will not be published.