您当前位置:优侠库 > 资讯攻略 >
来源:未知
2022-03-02 12:26:07 浏览: 分类:资讯攻略

ORACLE清空某用户下所有表记录truncate

声明

towner varchar 2(30);

开始

towner:= ' & amp;用户';

/*

首先禁用表上的所有外键约束。

*/

对于c in(select ' alter table ' | | owner | | ' . '| | t . table _ name | | ' disable CONSTRAINT ' | | t . CONSTRAINT _ name as csql from all _ constraints t其中t.owner = towner,t.constraint_type='R ')

开始

立即执行c . csql;

dbms_output.put_line(c.csql|| '...........& radic');

例外

当其他人

dbms_output.put_line(c.csql|| '..........ⅹ');

结束;

结束循环;

/*

开始清理表数据。

*/

for c in (select owner,object_name,' truncate table '|| owner|| ' . '| | dsql形式的对象名

from all_objects其中object _ type = ' TABLE ' and owner = towner)循环

开始

立即执行c . dsql;

dbms_output.put_line(c.dsql || '...........& radic');

例外

当其他人

dbms_output.put_line(c.dsql|| '..........ⅹ');

结束;

结束循环;

/*

对表启用外键约束。

*/

对于c in(select ' alter table ' | | owner | | ' . '| | table _ name | | ' enable CONSTRAINT ' | | t . CONSTRAINT _ name as csql from all _ constraints t其中t.owner = towner,t.constraint_type='R ')

开始

立即执行c . csql;

dbms_output.put_line(c.csql|| '...........& radic');

例外

当其他人

dbms_output.put_line(c.csql|| '..........ⅹ');

结束;

结束循环;

结束;

关键词:甲骨文

优侠库网站每天提供最新最热门的安卓手机软件、游戏下载、分享热门手游资讯攻略教程、手机软件教程步骤,专注安卓手机游戏软件下载。

本文链接:http://www.123down.cn/gonglue/227378.html

攻略资讯
安卓软件
安卓游戏