One row works fine:
insert into maalerverdi.evverdigrenser (maalepktnr, fradato, tildato, telleverkartnr, minimum, maximum) values (100121, '01-jan-2019', '01-jun-2073', 202, -0.0001, 50)
But adding one more row does not work:
insert into maalerverdi.evverdigrenser (maalepktnr, fradato, tildato, telleverkartnr, minimum, maximum) values (100121, '01-jan-2019', '01-jun-2073', 202, -0.0001, 50), (100126, '01-jan-2019', '01-jun-2073', 202, -0.0001, 50);
Error: SQL command not properly ended
Advertisement
Answer
Your error message looks like Oracle’s ORA-00933
(whose message is SQL command not properly ended
). Indeed, this database (unlike many others) does not support the syntax you are using to insert multiple rows at once.
If you want to do this in a single statement, you can use the insert all
syntax instead. Its purpose is to insert
into one or multiple tables, so you need to repeat the table name and column list:
insert all into maalerverdi.evverdigrenser (maalepktnr, fradato, tildato, telleverkartnr, minimum, maximum) values (100121, '01-jan-2019', '01-jun-2073', 202, -0.0001, 50) into maalerverdi.evverdigrenser (maalepktnr, fradato, tildato, telleverkartnr, minimum, maximum) values (100126, '01-jan-2019', '01-jun-2073', 202, -0.0001, 50);
Side note: you seem to be attempting to insert into date
columns. If so, I would recommend using the standard syntax to declare date literals rather than this custom format (whether Oracle will successfully interpret it as a date depends on your database and session settings). That would be:
insert all into maalerverdi.evverdigrenser (maalepktnr, fradato, tildato, telleverkartnr, minimum, maximum) values (100121, date '2019-01-01', date '2073-06-01', 202, -0.0001, 50) into maalerverdi.evverdigrenser (maalepktnr, fradato, tildato, telleverkartnr, minimum, maximum) values (100126, date '2019-01-01', date '1973-06-01', 202, -0.0001, 50);