Oracle notes: Tables and fields (2)

Source: Internet
Author: User


Oracle notes: Tables and fields (2) 2. delete a FIELD in the TABLE: www.2cto.com delete a FIELD: alter table mtable drop column (FIELD) cascade constrains; OR: alter table mytable set unused (FIELD) cascade constrains; Delete multiple fields: alter table mytable drop (FIELD1, FIELD2); OR: alter table mytable set unused (FIELD1, FIELD2); the difference between the two is: when there are many data records, dropping takes a long time because each record needs to be scanned. UNUSED is a state, which is the same as DROP from the user's perspective, but data cannot be obtained through queries, however, it still occupies storage space. You can query the data dictionary view USER_UNUSED_COL_TABS, ALL_UNUSED_COL_TABS, and tables, and view tables with UNUSED status fields: LIKE: SELECT * FROM USER_UNUSED_COL_TABS; to completely delete the UNUSED state field, the statement is: alter table mytable drop unused column; 3. delete tables, restore tables, and view tables in the recycle bin: drop table mytable cascade constraints; restore: flashback table mytable to before drop; view in the recycle bin: SELECT OBJECT_NAME, ORIGINAL_NAME FROM repartition bin; WHERE: ORIGINAL_NAME is the table name and can also be specified using the WHERE condition, for example: ORIGINAL_NAME = 'mytable '.
 

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.