oracle中用一條語句,多表關(guān)聯(lián)刪除怎么寫啊?
修改你的外鍵設(shè)置,達到級聯(lián)刪除的目的,具體實現(xiàn)如下:
a)先查詢出EMP表和POS表中外鍵的名稱(如果你知道外鍵名這一步可以省略)selectCONSTRAINT_NAME,TABLE_NAMEfromuser_constraintswhereCONSTRAINT_TYPE#39R#39andTABLE_NAMEin(#39EMP#39,#39POS#39)
b)刪除EMP表和POS表上的外鍵后重新建立允許級聯(lián)刪除的外鍵模式altertableEMPdropconstraint外鍵名altertablePOSdropconstraint外鍵名altertableEMPaddconstraint外鍵名foreignkey(DEPT_NO)referencesDEPT(DEPT_NO)ondeletecascadealtertablePOSaddconstraint外鍵名foreignkey(DEPT_NO)referencesDEPT(DEPT_NO)ondeletecascad
在oracle中,如何用一條select語句查詢字段中非純數(shù)字值?
--1.正則判斷,適用于10g以上版本--非正整數(shù)select字段from表whereregexp_replace(字段,d,)isnotnull;--非數(shù)值類型select字段from表whereregexp_replace(字段,^[-]d(.d)$,)isnotnull;--2.自定義函數(shù),判斷非值類型createorreplacefunctionisnumber(colvarchar2)r:to_number(col);return1;exceptionwhenothersthenreturn0;end;select字段from表whereisnumber(字段)0;
