Kavin Palaniswamy
Kavin Palaniswamy

Reputation: 181

Truncate a table with multiple list partitions in oracle without having to mention the partition name

I have a table with multiple list partitions. I basically want to truncate all the partitions at once without having to mention the partition name. I did try using the plain truncate table tabl_name and it seems to work. I am quite new to partitions in oracle and am not too sure if this is the right way of doing it.

I also know from reading that i can delete multiple partitions using the alter table truncate partition command.

Thanks, Kavin

Upvotes: 1

Views: 3863

Answers (1)

David Aldridge
David Aldridge

Reputation: 52346

Yes, truncating the table truncates all partitions.

https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/TRUNCATE-TABLE.html#GUID-B76E5846-75B5-4876-98EC-439E15E4D8A4

If table is partitioned, then all partitions or subpartitions, as well as the LOB data and LOB index segments for each partition or subpartition, are truncated.

Note some of the documented side-effects also, such as UNUSABLE indexes being made USABLE.

Upvotes: 1

Related Questions