【问题标题】:Oracle Live SQL not allowing multiple row insertionOracle Live SQL 不允许多行插入
【发布时间】:2020-12-07 08:42:40
【问题描述】:

下面的代码使用示例数据。

INSERT INTO ClientSeller VALUES
(1,'John Smith',88,1,'a',1),
(2,'Joe Smith',12,2,'b',2),
(3,'Warren ',15,2,'c',3),
(4,'Karen',69,6,'d',5),
(5,'Bob',45,6,'e',55),
(6,'Owen',65,6,'f',4),
(7,'Steve',25,5,'g',8),
(8,'Peter',24,55,'a',88),
(9,'Zoe',245,8,'b',8),
(10,'Jacky',244,2,'c',8);

并显示: ORA-00933: SQL 命令未正确结束 谁能解释为什么这不执行?

【问题讨论】:

标签: sql oracle


【解决方案1】:

根据您的示例,我创建了下表。

Create table ClientSeller (
    identity number(2),
    name varchar2(50),
    employeno number(2),
    otherno number(1),
    letter char(1),
    otherotherno number(1) 
)

然后使用下面的代码,我可以将您的两个示例行插入表中。 Oracle 有一种非常笨拙的语法来将值插入到表中。对于每个值集,您绝对需要使用单独的 INTO 表名 VALUES xxxxx 插入全部,然后最后您必须从 DUAL 添加选择 1。详情请见this example

另外,不要以分号结束您的陈述。在此处提供的示例代码中,您都找不到这样的字符。

INSERT ALL
INTO ClientSeller VALUES (1,'John Smith',88,1,'a',1)
INTO ClientSeller VALUES (2,'Joe Smith',12,2,'b',2)
SELECT 1 from DUAL

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-09
    • 2018-11-30
    • 2021-11-24
    • 1970-01-01
    相关资源
    最近更新 更多