Deletes the data in a table while still maintaining the metadata definitions of the table. Advantages include fast deletion of data in uniform areas, and no change to dependency data.
1 – Environment
You can use the TRUNCATE TABLE statement: o In interactive SQL o Embedded in host language programs to be precompiled o As part of a procedure in an SQL module o In dynamic SQL as a statement to be dynamically executed
2 – Format
TRUNCATE TABLE ---> <table-name> ---->
3 – Arguments
3.1 – table-name
Specifies the name of the table you want to truncate.
4 – Examples
Example 1: Deleting data from a table while still maintaining the metadata definitions The following example shows how to delete the data from the SALARY_HISTORY table and still maintain the metadata definitions: SQL> TRUNCATE TABLE salary_history; SQL> -- SQL> -- The table still exists, but the rows are deleted. SQL> -- SQL> SELECT * FROM salary_history; 0 rows selected SQL> SHOW TABLE (COLUMN) salary_history; Information for table SALARY_HISTORY Columns for table SALARY_HISTORY: Column Name Data Type Domain ----------- --------- ------ EMPLOYEE_ID CHAR(5) ID_DOM Foreign Key constraint SALARY_HISTORY_FOREIGN1 SALARY_AMOUNT INTEGER(2) SALARY_DOM SALARY_START DATE VMS DATE_DOM SALARY_END DATE VMS DATE_DOM