I am trying to figure out why I am getting this error message. I have tried revising the code in various ways and still getting an error message. Error message is listed below.
ORA-00923: FROM keyword not found where expected
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)
You can't use TABLE
nor COLUMN
as column aliases; rename them to something else, e.g.
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>
Alternatively, enclose aliases into double quotes:
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>
I've removed the last "condition" (which is invalid anyway, but didn't cause that problem).