drop table中cascade的含義及用法

2022-08-18 04:51:12 字數 463 閱讀 9772

在刪除乙個表時,如果該錶的主鍵是另乙個表的外來鍵,如果不用cascade關鍵字就會報錯:

sql>

drop

table

dict_loc_type;

drop

table

dict_loc_type

ora-02449: 表中的唯一/主鍵被外來鍵引用

使用cascade關鍵字,表被成功刪除:

sql>

drop

table dict_loc_type cascade

constraints;

table dropped

使用flashback語句可以恢復被刪除的表,但是被刪除的外來鍵無法恢復:

sql> flashback table dict_loc_type to before drop; 

done

drop table中cascade的含義及用法

在刪除乙個表時,如果該錶的主鍵是另乙個表的外來鍵,如果不用cascade關鍵字就會報錯 sql drop table dict loc type drop table dict loc type ora 02449 表中的唯一 主鍵被外來鍵引用 使用cascade關鍵字,表被成功刪除 sql dro...

drop table中cascade的含義及用法

在刪除乙個表時,如果該錶的主鍵是另乙個表的外來鍵,如果不用cascade關鍵字就會報錯 sql drop table dict loc type drop table dict loc type ora 02449 表中的唯一 主鍵被外來鍵引用 使用cascade關鍵字,表被成功刪除 sql dro...

hive恢復drop table資料

hive 中使用truncate命令將表截斷的話,它是不會進 站的,是沒辦法恢復的。這個跟oracle truncate有點類似的。恢復在hive中通過drop table刪除的資料檔案就是將hdfs dfs rm刪除掉的檔案進行恢復,只需要hdfs dfs mv將檔案從 站中搬過來就行,我就先使用...