我正在尝试创建一个SQL脚本,以自动将值插入到表中。
我有一个包含两列的表table1 :键、值。
我想插入几行:
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")如何将其放入可从命令行执行的shell脚本中。
谢谢
发布于 2012-06-20 02:49:03
另存为扩展名为.sql的文件。
然后使用SQLPLus之类的sql connection工具从命令行运行(您不需要指明您在哪个数据库上)
发布于 2012-06-20 02:51:06
您还应该将对同一个表的插入合并到一个表中,因为这样会快得多,如下所示:
INSERT INTO table1
(key, value) VALUES
("tomato1","$1"),
("tomato2","$2"),
("tomato3","$3"),
("tomato4","$4")https://stackoverflow.com/questions/11107391
复制相似问题