我有一个 insert into 语句,但有一个逗号错误,我无法修复它 [英] I have an insert into statement but there's an error with a comma and i just cant fix it

查看:20
本文介绍了我有一个 insert into 语句,但有一个逗号错误,我无法修复它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我必须做的代码,但它给出了一个错误,说代码没有正确结束,我看不到问题,也许我只是瞎了,但我不知道.

Here's the code i have to do but it gives an error saying the code has not been ended correctly and I cant see the problem, maybe I am just blind but i dont know.

 INSERT INTO Customer VALUES
    (11011, 'Jeffery', 'Smith', '18 Water RD', 0877277521, 'jef@isat.com'),(its giving me an error here and saying the statement hasn't ended correctly)
    (11012, 'Alex', 'Hendricks', '22 Water Rd', 0863257857 , 'ah@mcom.com'),
    (11013 , 'Johnson', 'Clark', '101 Summer Lane', 0834567891,'jclark@mcom.co.za'),
    (11014 , 'Henry', 'Jones', '55 Mountain Way',0612547895 ,'hj@isat.co.za'),
    (11015 , 'Andre', 'Williams', '5 Main Rd ', 0827238521,'aw@mcal.co.za');

推荐答案

Oracle 一次只支持按行插入.最简单的解决方案是多次插入:

Oracle only supports inserting on row at a time. The simplest solution is multiple inserts:

INSERT INTO Customer VALUES (11011, 'Jeffery', 'Smith', '18 Water RD', 0877277521, 'jef@isat.com');
INSERT INTO Customer VALUES (11012, 'Alex', 'Hendricks', '22 Water Rd', 0863257857 , 'ah@mcom.com');
INSERT INTO Customer VALUES (11013 , 'Johnson', 'Clark', '101 Summer Lane', 0834567891,'jclark@mcom.co.za');
INSERT INTO Customer VALUES (11014 , 'Henry', 'Jones', '55 Mountain Way',0612547895 ,'hj@isat.co.za');
INSERT INTO Customer VALUES (11015 , 'Andre', 'Williams', '5 Main Rd ', 0827238521,'aw@mcal.co.za');

其他解决方案是使用 insert all 或将语句从 values 转换为 select ...来自双重联合所有.

Other solutions are to use insert all or to convert the statements from values to select . . . from dual union all.

我还建议您明确列出列,以帮助防止无意中出现错误.

I would also advise you to explicitly list the the columns, to help prevent inadvertent errors.

这篇关于我有一个 insert into 语句,但有一个逗号错误,我无法修复它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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