您的查询是完全有效的,并在 sqlplus 中完全按照应有的方式运行:
14:04:01 (41)HR@sandbox> l
1 SELECT EMPLOYEE_ID, FIRST_NAME||' '||LAST_NAME AS FULLNAME
2 FROM EMPLOYEES
3 WHERE (JOB_ID, DEPARTMENT_ID)
4 IN (SELECT JOB_ID, DEPARTMENT_ID FROM JOB_HISTORY)
5* AND DEPARTMENT_ID=80
14:04:05 (41)HR@sandbox> /
34 rows selected.
Elapsed: 00:00:00.01
只有在出现语法错误时才会遇到 ORA-00923。像这样:
14:04:06 (41)HR@sandbox> ed
Wrote file S:\spool\sandbox\BUF_HR_41.sql
1 SELECT EMPLOYEE_ID, FIRST_NAME||' '||LAST_NAME AS FULLNAME X
2 FROM EMPLOYEES
3 WHERE (JOB_ID, DEPARTMENT_ID)
4 IN (SELECT JOB_ID, DEPARTMENT_ID FROM JOB_HISTORY)
5* AND DEPARTMENT_ID=80
14:05:17 (41)HR@sandbox> /
SELECT EMPLOYEE_ID, FIRST_NAME||' '||LAST_NAME AS FULLNAME X
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
可能您在将查询从 sqldeveloper 复制到 sqlplus 时做了一个?您确定您的帖子准确地包含符号到符号的查询吗?我会更加关注查询文本和错误消息——它通常指向一个错误,就像*
在X
我的示例中一样。