Renaming a column

#Renaming a column. To rename a column, write the desired name after the table name.
SELECT
col#,
segcollength,
offset,
name COLUMN_NAME,
type#,
length

FROM

col$;

<Output>

 

Quoted Identifier:

  • A quoted identifier begins and ends with double quotation marks (“). If you name a schema object using a quoted identifier, then you must use the double quotation marks whenever you refer to that object.
  • A nonquoted identifier is not surrounded by any punctuation

You can use either quoted or nonquoted identifiers to name any database object, with one exception: database links must be named with nonquoted identifiers.

In addition, Oracle Corporation strongly recommends that you not use quotation marks to make usernames and passwords case sensitive.

Important
1. Names must be from 1 to 30 bytes long with these exceptions:
a. Names of databases are limited to 8 bytes.
b. Names of database links can be as long as 128 bytes.

2. Nonquoted identifiers cannot be Oracle reserved words. Quoted identifiers can be reserved words, although this is not recommended. Nonquoted identifiers must begin with a letter.

 

Reserved Word Alert

The reserved word ROWID is an exception to this rule. You cannot use the uppercase word ROWID as a name, even in double quotation marks.

However, you can use the word with one or more lower case letters (for example, “Rowid” or “rowid“).

If there is a spece between the words for example, if I wanted to name the table COLUMN NAME. I would have to include quotation marks around the name.
#Putting qotation marks around names with spaces.
SELECT
col#,
segcollength,
offset,
name "COLUMN NAME",
type#,
length

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top