The only immediate way I can see to reproduce this is to change the NLS setings; but not NLS_LANGUAGE
as that would affect the error message as well. Using English is OK as you'd expect:
SQL> alter session set NLS_DATE_LANGUAGE='ENGLISH';
Session altered.
SQL> select value from nls_session_parameters
2 where parameter = 'NLS_DATE_LANGUAGE';
VALUE
--------------------------------------------------------------------------------
ENGLISH
SQL> insert into t42 (createddate)
2 values (to_timestamp('20-08-12 01.09.53.271000000 AM','DD-MM-RR HH.MI.SS.FF PM'));
1 row created.
Changing just the NLS_DATE_LANGUAGE
reproduces your error:
alter session set NLS_DATE_LANGUAGE='SLOVAK';
Session altered.
SQL> insert into t42 (createddate)
2 values (to_timestamp('20-AUG-12 01.09.53.271000000 AM','DD-MON-RR HH.MI.SS.FF PM'));
values (to_timestamp('20-AUG-12 01.09.53.271000000 AM','DD-MON-RR HH.MI.SS.FF PM'))
*
ERROR at line 2:
ORA-01855: AM/A.M. or PM/P.M. required
Changing NLS_LANGUAGE
, directly or through something that influences it, would make the error message appear differently as well:
SQL> alter session set NLS_LANGUAGE = 'SLOVAK';
Relácia zmenená.
SQL> insert into t42 (createddate)
2 values (to_timestamp('20-AUG-12 01.09.53.271000000 AM','DD-MON-RR HH.MI.SS.FF PM'));
values (to_timestamp('20-AUG-12 01.09.53.271000000 AM','DD-MON-RR HH.MI.SS.FF PM'))
*
ERROR v riadku 2:
ORA-01855: vy¿aduje sa AM/A.M. alebo PM/P.M.
You'd need a language that still recognises AUG
as a valid month, but doesn't use AM
/PM
; Slovak seems to fit the bill, so I'd guess that might be where you're from. Other languages may do the same too. Bit strange that the error message when NLS_LANGUAGE
is still set shows AM/PM, to but to_char(sysdate, 'HH AM')
indicates that message is wrong. With only NLS_DATE_LANGUAGE
set the message is in English anyway (try it with Turkish, for example, but you'd have to change the month name or switch use month numbers) and it always shows AM/PM.
If that is what's happening, either change the NLS_DATE_LANGUAGE
to English before running this script; or change your SQL Developer settings to use Slovak (or whatever you actually use) before doing the export - which would hopefully make the export use DOPOLUDNIE
/POPOLUDNIE
, though it wouldn't entirely surprise me if it didn't; or change the SQL Developer NLS_TIMESTAMP_FORMAT
to use 24-hour time (and a 4-digit year, and month numbers instead of names) for the export, which would avoid the issue entirely. Or run the script from SQL Developer, of course.