SQL多次插入到多行 [英] SQL Multiple Insert into multiple rows

查看:45
本文介绍了SQL多次插入到多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在不指定列名的情况下向表中插入多行,但是,在第一个逗号时出现错误,它是部分识别的规则,并且给了我一个错误

I'm trying to insert multiple rows into a table without specifying the column names, however, I get an error on the first comma that its a partially recognized rule and it's giving me an error

INSERT INTO MY_EMPLOYEE
VALUES(126,'Popov', 'Olga', 'opopov', 8500), 
    (127, 'Chen', 'Ling', 'lcheng', 14500), 
    (128, 'Dunn', 'David', 'ddunn', NULL);

推荐答案

我认为Oracle不支持具有多个记录的VALUES.这是一个简单的选择:

I don't think that Oracle supports VALUES with multiple records. Here is a simple alternative:

INSERT INTO MY_EMPLOYEE
    SELECT 126,'Popov', 'Olga', 'opopov', 8500 FROM DUAL UNION ALL
    SELECT 127, 'Chen', 'Ling', 'lcheng', 14500 FROM DUAL UNION ALL 
    SELECT 128, 'Dunn', 'David', 'ddunn', NULL FROM DUAL;

注意:我强烈建议您为插入指定列,但这是另一个问题.

Note: I do highly recommend that you specify the columns for the insert, but that is another issue.

这篇关于SQL多次插入到多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆