Oracle查看表之間的約束


----查看表約束 

表格: user_constraints 

查詢外鍵約束條件

select ' select count(*) from '||TABLE_NAME||';'
from user_constraints a
where
a.constraint_type = 'R'
and a.r_constraint_name='PK_JG0101';

----禁用相關外鍵約束
select 'ALTER TABLE '||TABLE_NAME||' DISABLE CONSTRAINT '||constraint_name||';'
From user_constraints A
where a.constraint_type = 'R'
and a.r_constraint_name='PK_XX0301'
and Status='ENABLED';

 

ALTER TABLE JS0101SQ DISABLE CONSTRAINT FK_JS0101SQ_XX0301;

----啟用相關外鍵約束

ALTER TABLE JS0101SQ ENABLE CONSTRAINT FK_JS0101SQ_XX0301;

 

---查看數據庫中的表名

表:user_tables 

select 'Drop table '|| TABLE_NAME||';'
from user_tables where TABLE_NAME like 'TEMP1%';

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM