Oracle keyword use as field name method

Source: Internet
Author: User

Sometimes we use the same name as the Oracle keyword when we define field names and aliases, so how do we handle them?
It's really simple, just add "" To this keyword, like "group"

Sql>DROP TABLE k; Table dropped--CREATE table K, field named UID (Oracle keyword) SQL>CREATE TABLE K (UID INT); CREATE TABLE K (UID INT) ORA-00904:: Invalid IDENTIFIER--Field name plus""table Create Successful SQL> CREATE TABLE k ("UID"INT); Table created--insert some data SQL> INSERT into K VALUES (1);1Row Insertedsql> INSERT into K VALUES (2);1Row Insertedsql> INSERT into K VALUES (3);1Row Inserted--The query is not added""are normal (not likely to conform to specification) SQL>SELECT UID from K; UID----------555SQL> SELECT"UID"From K; UID---------------------------------------123--must be added when update""SQL> UPDATE k SET uid=5WHERE uid=3; UPDATE k SET UID=5WHERE uid=3ORA-01747: Invalid User.table.column, table.column, or column Specificationsql> UPDATE k SET"UID"=5WHERE"UID"=3;

1 row UPDATED
Summary : Oracle can refer to keywords as aliases for field names and query statements in the form of keywords. If it is not a special case, it is best not to use it to avoid errors in the code writing process.

Oracle keyword use as field name method

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.