0

我希望你一切都好。我需要您帮助解决以下来自 kaplan trianing 考试问题的问题。下面的查询被认为是正确的答案,但我无法让它工作。请您检查并提供建议。

rgd的

诺曼

SQL> EDIT
Wrote file afiedt.buf



INSERT INTO
(SELECT PHYSICIAN_ID, LAST_NAME, FIRST_NAME, LICENSE_NO, HIRE_DATE
FROM PHYSICIAN
WITH CHECK OPTION
WHERE LICENSE_NO BETWEEN 1 AND 200)
VALUES (PHY_NUM_SEQ.NEXTVAL, '&LNAME', '&FNAME', &LNO, SYSDATE)

SQL> /
**Enter value for lname: BARRETT

Enter value for fname: NORMAN

Enter value for lno: 1**

old   6: VALUES (PHY_NUM_SEQ.NEXTVAL, '&LNAME', '&FNAME', &LNO, SYSDATE)
new   6: VALUES (PHY_NUM_SEQ.NEXTVAL, 'BARRETT', 'NORMAN', 1, SYSDATE)
WHERE LICENSE_NO BETWEEN 1 AND 200)

*

> **ERROR at line 5: ORA-00907: missing right parenthesis**



SQL> `SELECT PHY_NUM_SEQ.NEXTVAL FROM DUAL;`



   NEXTVAL
----------
         1



SQL> DESC PHYSICIAN


Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 PHYSICIAN_ID                              NOT NULL NUMBER
 LAST_NAME                                 NOT NULL VARCHAR2(30)
 FIRST_NAME                                NOT NULL VARCHAR2(25)
 LICENSE_NO                                NOT NULL NUMBER(7)
 HIRE_DATE                                          DATE


SQL>
4

1 回答 1

1

WITH CHECK OPTION导致错误的行

ORA-00907: 缺少右括号

在您的SELECT声明中。

删除那条线就足够了。

于 2018-05-25T10:33:25.640 回答