Differences between truncate and delete in Oracle delete operations

Source: Internet
Author: User


Oracle delete operations truncate differs from delete operations. truncate can delete all records in a table, release the tablespace, and only retain the table structure. Syntax: truncate table tableName; delete. If there is no where condition, it also deletes all records in the table, but does not release space. Syntax: delete tableName where condition. The differences between www.2cto.com truncate and delete include the following: 1. TRUNCATE is very fast in various tables, whether large or small. If the ROLLBACK command DELETE is used, the TRUNCATE command is not used. 2. TRUNCATE is a DDL language. Like all other DDL languages, it will be implicitly submitted and cannot use the ROLLBACK command for TRUNCATE. 3. TRUNCATE will reset the high horizontal line and all indexes. When you completely browse the entire table and index, the table after the TRUNCATE operation is much faster than the table after the DELETE operation. 4. TRUNCATE cannot trigger any DELETE trigger. 5. You cannot grant anyone the permission to clear tables of others. 6. After the table is cleared, the index of the table and the table is reset to the initial size, while the delete statement is not. 7. The parent table cannot be cleared. Www.2cto.com truncate table (schema) table_name DROP (REUSE) STORAGE by default is drop storage. When drop storage is used, the TABLE and TABLE index are shortened, and the TABLE is minimized, and reset the NEXT parameter. Reuse storage does not shorten the table or adjust the NEXT parameter to use reuse storage in special circumstances. By default, the truncate table tablename operation is not allowed in the stored procedure. The following method is used: execute immediate 'truncate table tablename ';

Related Article

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.