SQL:从所有可用表中删除所有数据 [英] SQL: delete all the data from all available tables

查看:131
本文介绍了SQL:从所有可用表中删除所有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用oracle DB维护30多个表,如何删除所有表中的所有数据?我只想删除数据但不删除表.

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.

推荐答案

生成脚本以截断(=删除所有表中的所有行):

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

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

然后执行脚本.

这篇关于SQL:从所有可用表中删除所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆