尝试在 SQL.Always 中的 table 中插入多行显示 SQL 命令未正确结束

Trying to insert multiple rows in my table in SQL.Always showing SQL Command not ended properly

我正在尝试使用以下查询将多行插入到我的 table 中:INSERT INTO TABLE2(ID) VALUES(1),(2) 。它显示 SQL 命令未结束.

是语法错误吗?我已经重新检查了,但仍然不清楚哪里出了问题。

当然是语法无效。但是,这里有 3 个可行的选项。

SQL> create table table2(id number);

Table created.

SQL>
SQL> insert into table2(id) values(1);

1 row created.

SQL> insert into table2(id) values(2);

1 row created.

SQL>
SQL> insert all
  2    into table2(id) values (1)
  3    into table2(id) values (2)
  4  select * from dual;

2 rows created.

SQL>
SQL> insert into table2(id)
  2  select 1 from dual
  3  union all
  4  select 2 from dual;

2 rows created.

SQL>