我试图弄清楚为什么我收到此错误消息。我试图以各种方式修改代码,但仍然收到错误消息。错误消息在下面列出。
ORA-00923 :在预期位置找不到FROM关键字
SELECT 'DATABASE' as DATABASE,
OWNER AS SCHEMA,
TABLE_NAME AS TABLE,
COLUMN_NAME AS COLUMN
FROM ALL_TAB_COLUMNS
WHERE OWNER = 'ALSCMGR'
AND TABLE_NAME IN ('ALSC_TRANS_NONMONETARY')
AND UPPER(COLUMN_NAME)
答案 0 :(得分:5)
您不能将TABLE
或COLUMN
用作列别名;将它们重命名为其他名称,例如
SQL> SELECT
2 'DATABASE' as DATABASE,
3 OWNER AS SCHEMA,
4 TABLE_NAME AS TABLE_n,
5 COLUMN_NAME AS COLUMN_n
6 FROM
7 ALL_TAB_COLUMNS
8 WHERE
9 OWNER = 'ALSCMGR' AND
10 TABLE_NAME IN('ALSC_TRANS_NONMONETARY')
11 --and UPPER(COLUMN_NAME) ;
no rows selected
SQL>
或者,将别名用双引号引起来:
SQL> SELECT
2 'DATABASE' as DATABASE,
3 OWNER AS SCHEMA,
4 TABLE_NAME AS "TABLE",
5 COLUMN_NAME AS "COLUMN"
6 FROM
7 ALL_TAB_COLUMNS
8 WHERE
9 OWNER = 'ALSCMGR' AND
10 TABLE_NAME IN('ALSC_TRANS_NONMONETARY')
11 --and UPPER(COLUMN_NAME) ;
no rows selected
SQL>
我删除了最后一个“条件”(无论如何都无效,但没有引起该问题)。