ORA-01810 format code appears twice

I got ” ORA-01810 format code appears twice ”  error in Oracle database.

 

ORA-01810 format code appears twice

 

Details of error are as follows.

ORA-01810 format code appears twice

Cause: A format code was listed twice in a date specification. Each format code may be
 specified only once in the function TO_DATE.

Action: Remove the duplicate format code from the date specification, then retry the operation.
   

 

 

format code appears twice

This ORA-01810 error is related with the format code was listed twice in a date specification. Each format code may be specified only once in the function TO_DATE.

Remove the duplicate format code from the date specification, then retry the operation.

TO_DATE function format codes are as follows, so check your code and fix the error.

Format CodeExplanation
YEARYear, spelled out
YYYY4-digit year
MMMonth (01-12; JAN = 01).
MONAbbreviated name of month.
MONTHName of month, padded with blanks to length of 9 characters.
DDay of week (1-7).
DAYName of day.
DDDay of month (1-31).
DDDDay of year (1-366).
DYAbbreviated name of day.
HHHour of day (1-12).
HH12Hour of day (1-12).
HH24Hour of day (0-23).
MIMinute (0-59).
SSSecond (0-59).
SSSSSSeconds past midnight (0-86399).

For example; If you run the following code, you will get this error.

SELECT TO_DATE('2021/05/06 4:29 PM', 'YYYY/MM/DD HH:MM PM' ) FROM dual;

 

You got this error, because you have used MM twice, you should use the MI instead of MM as follows.

SELECT TO_DATE('2021/05/06 4:29 PM', 'YYYY/MM/DD HH:MI PM' ) FROM dual;

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Leave a Reply

Your email address will not be published. Required fields are marked *