我遇到了神谕错误,
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')
/我在“/”之前的每个语句的末尾添加了分号。
有什么建议我可能错了吗?
发布于 2021-12-15 19:54:06
你没有发布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语句(我没有更改任何内容):
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-00933 (SQL命令没有正确结束)。因此,要么你没有发布你应该拥有的一切,要么你误解了现实。
https://stackoverflow.com/questions/70366526
复制相似问题