Oracle Database 10g Express Edition AND Date Formats
Replace:
,'20-12-2004'
...with:
, TO_DATE('20-12-2004', 'DD-MM-YYYY')
Reference: TO_DATE
Richard Knop
I'm a software engineer mostly working on backend from 2011. I have used various languages but has been mostly been writing Go code since 2014. In addition, I have been involved in lot of infra work and have experience with various public cloud platforms, Kubernetes, Terraform etc. For databases I have used lot of Postgres and MySQL but also Redis and other key value or document databases. Check some of my open source projects: https://github.com/RichardKnop/machinery https://github.com/RichardKnop/go-oauth2-server https://github.com/RichardKnop
Updated on June 04, 2022Comments
-
Richard Knop almost 2 years
I'm new to Oracle (I've been using MySQL mainly until now) so this might be a dumb question. But I have created this table (names are not english but ignore that, that is not important):
CREATE TABLE Auta ( id_auto NUMBER(5) UNIQUE NOT NULL, typ CHAR(10), specifikacia_typu CHAR(15), SPZ CHAR(8), farba CHAR(20), datum_vyroby DATE, pocet_miest NUMBER(2), pociatok_km NUMBER(6), poplatok_denny NUMBER(4), poplatok_km NUMBER(2));
Then I tried using this INSERT query:
INSERT INTO Auta VALUES ( 1 ,'Audi' ,'A6' ,'KE1-1548' ,'cierna' ,'20-12-2004' ,5 ,158749 ,1356 ,88 );
And I get an error:
ORA-01843: not a valid month
The date format I am using is DD-MM-YYYY. I also tried DD.MM.YYYY, DD/MM/YYYY, I also tried switching month and day like this - MM-DD-YYYY, MM/DD/YYYY - and still the same error.
What to do?
-
john_science over 11 yearsHere on SO we prefer answers where you explain WHY you are saying what you are saying. Perhaps add some text to your answer so the OP understands your suggestion. Thanks!
-
Pradeep about 11 yearsThis is not a proper answer. It does not have any insight to the technical problem at hand.