SQL: delete all the data from all available tables

前端 未结 9 1151
小蘑菇
小蘑菇 2020-12-09 08:43

I am using oracle DB to maintain more than 30 tables, how can I delete all the data from all the tables? I only want to delete the data but not drop the tables.

9条回答
  •  遥遥无期
    2020-12-09 09:16

    Generate a script to truncate (= remove all rows from) all tables:

    select 'truncate table ' || table_name || ';' from user_tables
    

    And then execute the script.

提交回复
热议问题