Can e truncate some of the rows from the table instead of truncating the full table.

Showing Answers 1 - 12 of 12 Answers

Mohit Kumar Verma

  • Feb 21st, 2006
 

No , it is not possible. Truncate is a DDL Command and we can not where clause in Truncate.

Unmesh

  • May 10th, 2006
 

You can truncate few rows from a table if the table is partitioned. You can truncate a single partition and keep remaining.

Girish Bhatia

  • Jul 18th, 2006
 

Unmesh can you explain how is it possible with example.

  Was this answer useful?  Yes

Sourajit

  • Dec 28th, 2006
 

Here is the example:

CREATE TABLE parttab (
state  VARCHAR2(2),
sales  NUMBER(10,2))
PARTITION BY LIST (state) (
PARTITION northwest VALUES ('OR', 'WA')
 TABLESPACE uwdata,
PARTITION southwest VALUES ('AZ', 'CA')
 TABLESPACE uwdata);

INSERT INTO parttab VALUES ('OR', 100000);
INSERT INTO parttab VALUES ('WA', 200000);
INSERT INTO parttab VALUES ('AZ', 300000);
INSERT INTO parttab VALUES ('CA', 400000);
COMMIT;

SELECT * FROM parttab;

ALTER TABLE parttab
TRUNCATE PARTITION southwest;


SELECT * FROM parttab;

Vishal R Bhadange

  • Aug 12th, 2012
 

Yes.
Yes we can truncate some of the rows from the table, But table should be partitioned & all the rows to be deleted should be present in one single partition...

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions