20110418_批處理sql 語句的寫法_oracle !!的使用

--查詢
select 'drop view ' || object_name || ';'
from user_objects
where object_type='VIEW'
and status='INVALID';
--執行


2.  刪除所有客戶化觸發器,即所有非“_T”結束的觸發器;
備份觸發器trigger_backup.sql

--查詢
select 'DROP trigger ' || trigger_name || ';'
from user_triggers where
(trigger_name not like '%\_T' escape '\')
and (upper(trigger_name) not in (select upper(triggername) from maxtriggers)) ;
--執行

 

3、

原因:父設備存在的設備編碼,在系統中不存在。
解決:刪除此種數據

select 'update equipment e set e.parent=null where e.eqnum='||a.eqnum|| ';'
from equipment a
    where not exists (select 1 from equipment b where a.parent = b.eqnum)
      and a.parent is not null

發佈了61 篇原創文章 · 獲贊 4 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章