From the course: Oracle Database 19c: Advanced SQL

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Truncating tables

Truncating tables

- [Instructor] The truncate command is quite useful when manipulating tables in your Oracle database. But it can be a double-edged sword. It's fast, but it can cause issues when transaction enemicity and concurrency is expected. It also has recoverability implications. Therefore, you need to understand the consequences to use it effectively. Given what it does to a table, the truncate command acts like the Delete DML statement, it quickly deletes all rows in a table, there is no middle ground, however, it's all or nothing, it can't delete just some rows, only all of them at once. And because of this, there're some side effects that put it outside of the DML commands. Before I talk about those side effects, here's the syntax of truncate, you can truncate a table in another schema, but you must have the drop any table system privilege, which I'll also discuss in a later slide. When you truncate a table, you have the option to keep all the storage allocated along with the high watermark,…

Contents