oracle删除实体,oracle 按条件删除、查询表
---查詢表的名稱,字段信息以及字段注釋
select
us.table_name, --表名
ut.COLUMN_NAME,--字段名稱
uc.comments,--字段注釋
ut.DATA_TYPE,--字典類型
ut.DATA_LENGTH,--字典長度
ut.NULLABLE--是否為空
from user_tab_columns ut
inner JOIN user_col_comments uc
on ut.TABLE_NAME = uc.table_name and ut.COLUMN_NAME = uc.column_name
inner JOIN user_tables us on ut.TABLE_NAME = us.table_name
and us.TABLE_NAME not like '%ITSM%' --模糊查詢表明
AND us.TABLE_NAME not like '%CAS%'
AND us.TABLE_NAME not like '%SYSM%'
AND us.TABLE_NAME not like '%RESM%'
order by ut.TABLE_NAME
--刪除
select 'drop table ' || t.TABLE_NAME ||';'
from user_tables t
where t.TABLE_NAME like 'BSM%'
or t.TABLE_NAME like 'MV%'
or t.TABLE_NAME like 'PORTAL%'
or t.TABLE_NAME like 'TD%'
or t.TABLE_NAME like 'TF%'
or t.TABLE_NAME like 'UNIGRP%'
將查詢出來的結果復制,執行
注意刪除之前先備份,不然哭都找不到地方
總結
以上是生活随笔為你收集整理的oracle删除实体,oracle 按条件删除、查询表的全部內容,希望文章能夠幫你解決所遇到的問題。