Do not use double quotation marks when creating an alias for a view.

Source: Internet
Author: User

Create an alias in the View:

Internally, Oracle processes all aliases and table names in uppercase. These column names and table names are stored in the data dictionary in the form of uppercase, and Oracle also wants them to be capitalized. When you enter an alias to create a view, the alias should not be enclosed in quotation marks. Adding double quotation marks to the alias will make the names of the columns stored in Oracle a mix of upper and lower case. If this is done, the column names cannot be found in Oracle when the SELECT statement is executed unless double quotation marks are added to all queries.

Do not use double quotation marks when creating an alias for a view.

 

SQL> select * from dual;

Dummy
-----
X

SQL> -- create a test View
SQL> Create view v_test
2 select dummy "newname" from dual;

View created

SQL> select * From v_test;

Newname
-------
X

SQL> -- if the aliases in the newly created view are case-insensitive and enclosed in quotation marks, the query results column names are case-insensitive.
SQL> -- if the field is not enclosed by quotation marks when a query column is specified, the system will prompt that the column cannot be found.
SQL> select newname from v_test;

Select newname from v_test

ORA-00904: Invalid column name

SQL> select newname from v_test;

Select newname from v_test

ORA-00904: Invalid column name

SQL> select "newname" from v_test;

Newname
-------
X

SQL> -- it is best not to enclose aliases in quotation marks when creating a view.
SQL> -- delete test View
SQL> drop view v_test;

View dropped

SQL>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.