Create a test table in the database. The database version is ORACLE 10.2.0.1.0) and the table name is test in lower case. The script is as follows:
- Create table test
- (
- Id NUMBER (10 ),
- Name VARCHAR2 (20 ),
- Sex VARCHAR (2)
- )
- -- The corresponding data cannot be found.
- SELECT * FROM USER_TABLES WHERE TABLE_NAME = 'test'
- -- Use uppercase to check the corresponding data
- SELECT * FROM USER_TABLES WHERE TABLE_NAME = 'test'
- -- The corresponding data cannot be found.
- SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'test ';
- SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'test ';
Next we will use double quotation marks to create another table ("" in ORACLE is used to force case sensitivity and "when using keywords for fields). The script is as follows:
- Create table "test1"
- (
- "Id" NUMBER (10 ),
- "Name" VARCHAR2 (20 ),
- "SEX" VARCHAR (2)
- )
- SELECT * FROM USER_TABLES WHERE TABLE_NAME = 'test1 ';
- SELECT * FROM DBA_TABLES WHERE TABLE_NAME = 'test1 ';
- SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'test1 ';
- SELECT * FROM "test1 ";
- -- ORA-00942: Table or attempt not to exist
- SELECT * FROM test1;
- -- ORA-00904: "NAME": Invalid identifier
- SELECT id, Name, sex from "test1 ";
- -- ORA-00904: "ID": Invalid identifier
- SELECT id, "Name", sex from "test1 ";
- SELECT "id", "Name", sex from "test1 ";
- -- ORA-00942: Table or attempt not to exist
- SELECT "id", "Name", sex from test1;
The above example may seem strange. This phenomenon does not exist in SQL SERVER. This is because when creating a table or field in ORACLE without double quotation marks, ORACLE converts all the table names and field names to uppercase letters and then writes them into the data dictionary. When accessing the data dictionary, ORACLE converts it into a large write without double quotation marks and then searches for the data fields. Double quotation marks are case sensitive. Not only are keywords case insensitive, function names, process names, table names, variable names, user names, and passwords in pl/SQL blocks are case insensitive.
Some people may not like to use uppercase letters for table names and fields, but prefer lowercase or case-insensitive forms. If so, you should pay attention to it when writing scripts in ORACLE, not properly handled, this will bring you "endless troubles"
As shown above, you must add "" to the field; otherwise, an error is reported, where is the fire. Sometimes, people are very careless and forgetful. Therefore, we recommend that you use uppercase letters in ORACLE. This may make you feel a little uncomfortable at first, but just get used to it. It is always better than using "" to bring many hidden risks to subsequent development.
In ORAClE, scripts and fields are often written in uppercase. Some people say they can improve efficiency. This reduces the overhead for forced conversion, if there is no double quotation marks. Some also say these overhead are negligible, there will be no performance issues. Of course, the scripts are all in uppercase and consistent, which can prevent the same script from being parsed multiple times due to Case sensitivity issues. This is certainly true ). The younger brother is not talented and cannot be determined. There is little information on the Internet. I hope you can discuss it.