Oracle table name double quotation mark Deletion

Source: Internet
Author: User

In Oracle10g, I did not pay attention when creating the table. I directly created the table using the SQL statement sent to me by someone else. After the table is created, the Select * from table name is found. The system prompts that the table or view does not exist.
Later, I checked it carefully and found that during the create operation, the table name and field name were added with double quotation marks. If the table name and field name were created incorrectly, It would be rebuilt. I found that the deletion could not be deleted, and I checked it online, this method is successfully deleted and recorded as follows:
Recently, when using powerdesigner to generate an Oracle database SQL statement, it was found that both the table and field names contain quotation marks. For example:

Create Table "authorisbn "(

"Authorid" integer not null,

"Tit_isbn" varchar2 (20 ),

"Aut_authorid" integer,

"ISBN" varchar2 (20 ),

Constraint pk_authorisbn primary key ("authorid ")

); If you generate a table in this way, the query or insertion of data will show table or view does not exist (the table or view does not exist), and then let you get frustrated, these tables exist in the Oracle database (I am a Scott user), but you can delete these tables (drop table name or drop table "table name ") it cannot be deleted. After searching for materials and research, it is found that Scott's user permissions are insufficient. The solution is: First connect to the System user and use the command to grant select any table
To Scott; (this command means to authorize Scott to select any table), so that you can connect to the Scott user, this table can be queried (select * from "table name"), but the table name must be enclosed by quotation marks. To delete this table (drop table "table name"), quotation marks are also required. Why are quotation marks on the table name and field name of the Oracle Database SQL statement generated by powerdesigner? Because one rule for creating a table in Oracle is:

You can use uppercase or lowercase letters to name a table. Oracle is case insensitive as long as the table name or field name is not enclosed in double quotation marks. Oracle supports double quotation marks. However, it is best not to use double quotation marks directly. So how can we avoid these quotation marks? In powerdesiger, find edit current DBMS under database in physical data model, and select SCRIPT> SQL> format. There is a casesensitivityusingquote, its comment is "determines if the case
Sensitivity for identifiers is managed using double quotes ", indicating whether double quotation marks are used to specify the case sensitivity of the identifier. You can see that the default value of values on the right is" yes "and changed to" no ", click application. When the SQL statement is generated again, no quotation marks are provided for the table and field names.

From: http://hi.baidu.com/chenkuntian/blog/item/e380b4cca2452b5df31fe740.html right-click Database --> properties ---> select tab page "general" --> click "DBMS" properties on the right --> select tab page "General ", select SCRIPT> SQL> format. The following operations are the same as above. Select No and click OK.

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.