I'm trying to create an SQL script to automatize inserting of values into a table.
I have a table table1 with 2 columns: key, value.
I want to insert a few rows:
INSERT INTO table1 (key, value) VALUES ("tomato1","random_value_1")
INSERT INTO table1 (key, value) VALUES ("tomato2","random_value_2")
INSERT INTO table1 (key, value) VALUES ("tomato3","random_value_3")
INSERT INTO table1 (key, value) VALUES ("tomato4","random_value_4")
How can I put this into a shell script that I can execute from command line.
Thanks
save as a file with .sql extension.
then run from the command line with a sql connection tool like SQLPLus (you don't indicate which database you are on)
You should also combine inserts to the same table into one, as it is much faster, like so: