Home » SQL & PL/SQL » SQL & PL/SQL » column alias
column alias [message #314780] Thu, 17 April 2008 14:30 Go to next message
snow12
Messages: 9
Registered: April 2008
Junior Member
Hello:

I also have another error.

SQL> CREATE OR REPLACE VIEW viewQuestions
  2  AS
  3     SELECT Number,
  4            NAME,
  5            address1,
  6            address2,
  7            address3,
  8            address4,
  9            address5,
 10            username,
 11            phone,
 12            extension,
 13            fax,
 14            code,
 15            poNumber,
 16            poLineItem,
 17            ReportNumber,
 18            cNumber,
 19            PNumber,
 20            SUBSTR(reasonReturn, 1, 2000),
 21            SUBSTR(reasonReturn, 2001, 2000),
 22            SUBSTR(reasonReturn, 4001, 1000),
 23            contact,
 24            nformance
 25       FROM vwQuestions ;
          SUBSTR(reasonReturn, 1, 2000),
          *
ERROR at line 20:
ORA-00998: must name this expression with a column alias


Thanks

H
Re: column alias [message #314790 is a reply to message #314780] Thu, 17 April 2008 15:31 Go to previous messageGo to next message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
Is not the error description self-explanatory? If you do not think so, check http://ora-00998.ora-code.com/
Quote:
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. When expressions or functions are used in a view, all column names for the view must be explicitly specified in the CREATE VIEW statement.

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

Do you really want the column to have name "SUBSTR(reasonReturn, 1, 2000)".
Anyway, you shall specify the desired name as alias.
Re: column alias [message #314942 is a reply to message #314780] Fri, 18 April 2008 06:21 Go to previous message
xrkra
Messages: 2
Registered: April 2008
Location: Hyderabad
Junior Member
If you are creating a view with expression in select statement, it must have alias. You need to give col. alias for expression in line no. 20,21 & 22.

Rajesh
Previous Topic: How to drop and recreate a schema?
Next Topic: Concatenation and Insertion
Goto Forum:
  


Current Time: Sat Feb 15 17:48:04 CST 2025