ORA-00998: must name this expression with a column alias

ORA-00998: must name this expression with a column alias

Oracle SQL Error: ORA-00998: must name this expression with a column alias

Cause:

An expression or function was used in a CREATE VIEW statement, but no corresponding column name was specified.




Solution:

Enter a column name for each column in the view in parentheses after the view name.

Example:

CREATE VIEW BOOKS_VIEW AS 
SELECT ROWID, ID, NAME FROM BOOKS;

Output:

SQL Error: ORA-00998: must name this expression with a column alias

Correct

CREATE VIEW BOOKS_VIEW AS 
SELECT ROWID as row_id, ID, NAME FROM BOOKS;

Output:

view BOOKS_VIEW created.