Oracle PL/SQL/Table/TRUNCATE TABLE
Truncate a table
SQL>
SQL> truncate table emp_id_key_table;
TRUNCATE TABLE Demo
delete from PURCHASE;
SQL>
SQL> CREATE TABLE purchase (
2 product_name VARCHAR2(25),
3 quantity NUMBER(4,2),
4 purchase_date DATE,
5 salesperson VARCHAR2(3)
6 );
Table created.
SQL>
SQL> INSERT INTO purchase VALUES ("A", 1, "14-JUL-03", "CA");
1 row created.
SQL> INSERT INTO purchase VALUES ("B", 75, "14-JUL-03", "BB");
1 row created.
SQL> INSERT INTO purchase VALUES ("C", 2, "14-JUL-03", "GA");
1 row created.
SQL> INSERT INTO purchase VALUES ("D", 8, "15-JUL-03", "GA");
1 row created.
SQL> INSERT INTO purchase VALUES ("A", 20, "15-JUL-03", "LB");
1 row created.
SQL> INSERT INTO purchase VALUES ("B", 2, "16-JUL-03", "CA");
1 row created.
SQL> INSERT INTO purchase VALUES ("C", 25, "16-JUL-03", "LB");
1 row created.
SQL> INSERT INTO purchase VALUES ("D", 2, "17-JUL-03", "BB");
1 row created.
SQL>
SQL> SELECT * FROM purchase;
PRODUCT_NAME QUANTITY PURCHASE_ SAL
------------------------- ---------- --------- ---
A 1 14-JUL-03 CA
B 75 14-JUL-03 BB
C 2 14-JUL-03 GA
D 8 15-JUL-03 GA
A 20 15-JUL-03 LB
B 2 16-JUL-03 CA
C 25 16-JUL-03 LB
D 2 17-JUL-03 BB
8 rows selected.
SQL>
SQL>
SQL>
SQL> TRUNCATE TABLE purchase;
Table truncated.
SQL>
SQL> SELECT * FROM purchase;
no rows selected
SQL>
SQL>
SQL> drop table purchase;
Table dropped.
SQL>