Home sql Error: Not a Valid Month

Error: Not a Valid Month

Author

Date

Category

The following 2 requests return target results

select sysdate from dual; - 19.08.2015
   select to_char (to_date ('19 .08.2015 ',' dd.mm.yyyy '),' yyyy / mm / dd ') from dual;
- 2015 / 08/19

Question:
Can I ask a month through the letters? If so, in what language to set and how to see the settings?

select to_date ('15 -jan-10 ') from dual;

Returns an error:

SQL Error: ORA-01843: Not a Valid Month
01843. 00000 – “NOT A VALID MONTH”


Answer 1, Authority 100%

You can and through the letter code, but it is more susceptible to the installed language standards

select to_date ('15-yyan-10 ',' dd-mon-yy ') from dual;
select to_date ('15 -jan-10 ',' dd-mon-yy ') from dual;

The NLS_DATE_LANGUAGUA parameter corresponds to the language setting. You can view the settings through the request

select * from nls_session_parameters;

You can also rigidly specify the language

select to_date ('15 -jan-10 ',' dd-mon-yy ',' nls_date_language = american ' ) from dual;

Answer 2, Authority 67%

Yes, you can set the letters in the letters, only you need to specify the date format.
For example

select to_date ('15-yyan-10 ',' dd-mon-yy ') from dual;
select to_date ('15 -jan-10 ',' dd-mon-yy ') from dual;

How exactly is the month you can see in the NLS settings
Or execute such a request:

select to_char (sysdate, 'dd-mon-yy') from dual

More information about date formats can be read here

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions