Answer the question
In order to leave comments, you need to log in
Oracle 10g, ora-01843, how to set date?
I want to say right away that I'm not a professional in Oracle, but reading manuals and searching Google did not help.
Problem - lifted the new oracle 10g server, filled in the data.
When I try to interact with the data, I get an error - ora-01843 (not a valid month).
The data date looks like this: 19-DEC-07 .
I do the command: ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YY';
Then: SELECT TO_DATE('20-DEC-07') FROM TABLE;
I get the result ORA-01843: месяц не верен.
As a result, two questions:
1) What data format should be for this date as an example?
2) How to write information about the date format to the database so that the setting does not crash after the server is restarted?
Answer the question
In order to leave comments, you need to log in
Do "select sysdate from dual;" I think you have months there simply called in Russian. In general, I usually use nls_date settings to something like "DD-MM-YYYY" to avoid this. Months will be numbers.
1) ALTER SESSION SET NLS_DATE_FORMAT = 'MM-MON-YY';
Straight: MM-MON-YY? those. month-month-year
2) It's easier to specify the format in to_date itself
3) As far as I remember, the abbreviation depends on NLS_LANG on the client, i.e. check:
SELECT TO_DATE('20-Дек-07', 'DD-MON-YY') FROM TABLE;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question