Posted by: gandharba June 15, 2017
sql question
Login in to Rate this Post:     0       ?        
INSERT
INTO invoice_t
(
Invoice_Number, DATE_OF_PAYMENT,VIN_Number,Customer_ID
)
VALUES
(
'1234',to_date('03/20/2017','mm/dd/yyyy'),'1234567', '1'
);
1 row inserted.

-------------------------------------------------
INSERT
INTO invoice_t
(
Invoice_Number,DATE_OF_PAYMENT,VIN_Number,Customer_ID
)
VALUES
(
'1234','03/20/2017','1234567', '1'
);

SQL Error: ORA-01843: not a valid month
--------------------------------------------------------------------------------------------------
Remember to use different values for invoice_number or you might bump into unique constraint error since there is pk set on invoice_number.
--------
I doubt your constraints are set up correctly as all of your tables contain trailing _t but your constraint definition ignore 'em.
I would use something like this:
CONSTRAINT "INVOICE_T_PK" PRIMARY KEY ("INVOICE_NUMBER")
-----------
you do not need to write column names when writing insert statements, it is just for the purpose of ease, especially when there are large number of columns in a table.
INSERT
INTO invoice_t
VALUES
(
'1234',to_date('03/20/2017','mm/dd/yyyy'),'1234567', '1'
); will work just fine.
Read Full Discussion Thread for this article