Oracle : ORA-00933: SQL 命令未正确结束

Oracle : ORA-00933: SQL command not properly ended

我 运行 遇到了 oracle 错误,

ORA-00933: SQL 命令未正确结束

随着以下。

insert into TableOne (name, description, scopeid, readonly)
Select 'access', 'Some Description', 0, 0 from dual
where not exists(SELECT * FROM Privilege WHERE name = 'access')
/
insert into TableTwo (name, uuid, description, scopeid) 
Select 'Role','ROLE_UUID','Another description.', 0 from dual
where not exists(SELECT * FROM Role WHERE uuid = 'ROLE_UUID')
/

我在每个语句末尾的“/”之前添加了分号。

我有什么错误的建议吗?

你没有 post CREATE TABLE 声明所以我自己做了。

SQL> create table privilege as
  2    select 'some name' name from dual;

Table created.

SQL> create table role as
  2    select 'some UUID' uuid from dual;

Table created.

SQL> create table tableone
  2    (name        varchar2(10),
  3     description varchar2(20),
  4     scopeid     number,
  5     readonly    number);

Table created.

SQL> create table tabletwo
  2    (name        varchar2(10),
  3     uuid        varchar2(10),
  4     description varchar2(20),
  5     scopeid     number);

Table created.

SQL>

让我们 运行 insert 陈述你 post 的确切 copy/paste (我没有改变任何东西):

SQL> insert into TableOne (name, description, scopeid, readonly)
  2  Select 'access', 'Some Description', 0, 0 from dual
  3  where not exists(SELECT * FROM Privilege WHERE name = 'access')
  4  /

1 row created.

SQL> insert into TableTwo (name, uuid, description, scopeid)
  2  Select 'Role','ROLE_UUID','Another description.', 0 from dual
  3  where not exists(SELECT * FROM Role WHERE uuid = 'ROLE_UUID')
  4  /

1 row created.

SQL>

显然,它们都有效并且没有引发 ORA-00933SQL 命令未正确结束)。因此,要么你没有 post 你应该拥有的一切,要么你误解了现实。