The opening post of this discussion is no longer available. The replies are shown below.
Not quite sure what your question is but you can use INSERT with select subquery to pull the data from other tables to insert into INVOICE_t table. see the link for more help. https://www.techonthenet.com/o...
latinokiller · Jun 14, 2017 9:14 PM
Not sure I get your question but I suggest you try using to_date function as shown below. What error are you getting? INSERT INTO INVOICE_t (Invoice_Number, Date, VIN_Number, Customer_ID) VALUES (3456, to_date ('03/20/2016’,'mm/dd/yyyy'), ‘1234567’, ‘1’);
gandharba · Jun 14, 2017 10:14 PM
Hi newbie69, Write the column name DATE_of_Payment instead of Date Yours:- INSERT INTO INVOICE_t (Invoice_Number, Date, VIN_Number, Customer_ID) VALUES (3456, ’03/20/2016’, ‘1234567’, ‘1’); Mine:- INSERT INTO INVOICE_t (Invoice_Number, DATE_of_Payment, VIN_Number, Customer_ID) VALUES (3456, '03/20/2016', '1234567', '1');
SumOne1 · Jun 15, 2017 10:35 AM
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.
gandharba · Jun 15, 2017 12:23 PM
bro use a website called stackoverflow.com
raijayant · Jun 15, 2017 9:34 PM
This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.
Start a New Discussion