我遇到了一個 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')
/
我在每個陳述句的末尾'/'之前添加了分號。
任何我可能出錯的建議?
uj5u.com熱心網友回復:
你沒有發表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://www.uj5u.com/houduan/385720.html
