---
title: "oracle清空当前用户所有表数据存储过程"
author: "chokee"
date: "2011-08-01T11:11:01Z"
tags: []
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2011-08-01T11:11:01Z"
id: 1137120
url: "https://chokee.iteye.com/blog/1137120"
---

declare
  v_sql varchar2(2000);
  CURSOR cur is
    select table_name from user_tables order by table_name;
begin
  for rows in cur loop
    v_sql := 'TRUNCATE TABLE ' || rows.table_name;
    dbms_output.put_line(v_sql);
    execute immediate v_sql;
  end loop;
end;
/