2016-11-13 60 views
0

得到錯誤,同時使用兩個光標同時使用兩個光標

得到錯誤
[Error] PLS-00103 (45: 48): PLS-00103: Encountered the symbol 
     "TX_COM_LOCATION" when expecting one of the following: 

     := . (@ % ; 
    The symbol ":=" was substituted for 
    "TX_COM_LOCATION" to continue. 

請幫

+0

CREATE OR REPLACE PROCEDURE COM_LOCATION_TXM IS BEGIN DECLARE CURSOR TXM_COM_LOCATION IS SELECT COL1,COL2,從TBL_SAR_SALAS_1甲COL3; CURSOR TX_COM_LOCATION是 從TBL_LOCALES B中選擇col1,col2,col3; TMP_TXM TXM_COM_LOCATION%ROWTYPE; 開始 IF NOT TXM_COM_LOCATION%ISOPEN THEN OPEN TXM_COM_LOCATION; END IF; FETCH TXM_COM_LOCATION INTO TMP_TXM; EXIT WHEN TXM_COM_LOCATION%NOTFOUND; TMP_TXM TX_COM_COCATION%ROWTYPE; IF NOT TX_COM_LOCATION%ISOPEN THEN – Ajeet

+0

OPEN TXCOM_LOCATION; END IF; LOOP FETCH TX_COM_LOCATION INTO TMP_TX; 退出時TX_COM_LOCATION%NOTFOUND; BEGIN 插入語句() END; END LOOP; END LOOP; 承諾; END; END COM_LOCATION_TXM; / – Ajeet

+0

對不起,破壞代碼..並添加它.. – Ajeet

回答

0

檢查:

CREATE OR REPLACE PROCEDURE COM_LOCATION_TXM IS BEGIN DECLARE CURSOR TXM_COM_LOCATION IS SELECT COL1 ,col2,col3 FROM TBL_SAR_SALAS_1 A; CURSOR TX_COM_LOCATION IS SELECT col1,col2,col3 FROM TBL_LOCALES B; TMP_TXM TXM_COM_LOCATION%ROWTYPE; TMP_TXM TX_COM_LOCATION%ROWTYPE; BEGIN IF NOT TXM_COM_LOCATION%ISOPEN THEN OPEN TXM_COM_LOCATION;萬一; LOOP FETCH TXM_COM_LOCATION INTO TMP_TXM;退出時TXM_COM_LOCATION%NOTFOUND;如果不是TX_COM_LOCATION%ISOPEN,那麼打開TXCOM_LOCATION;萬一; LOOP FETCH TX_COM_LOCATION INTO TMP_TX;退出時TX_COM_LOCATION%NOTFOUND; BEGIN NULL; - 用INSERT語句替換NULL END; END LOOP; END LOOP;承諾;結束; END COM_LOCATION_TXM;

+0

不工作親愛的...它的說法[錯誤] PLS-00201(36:10):PLS-00201:標識符'TX_COM_COCATION'必須聲明.dont知道爲什麼 – Ajeet

+0

這是因爲類型名稱中的錯誤: –

+0

我已編輯我的帖子。嘗試一下。 –

0
CREATE OR REPLACE PROCEDURE COM_LOCATION_TXM 
IS 
BEGIN 
DECLARE CURSOR TXM_COM_LOCATION IS SELECT col1,col2,col3 from TBL_SAR_SALAS_1 A; 
CURSOR TX_COM_LOCATION is select col1,col2,col3 from TBL_LOCALES B; 
TMP_TXM TXM_COM_LOCATION%ROWTYPE; 
TMP_TXM TX_COM_COCATION%ROWTYPE; 
Begin 
IF NOT TXM_COM_LOCATION%ISOPEN 
THEN OPEN TXM_COM_LOCATION; 
END IF; 
FETCH TXM_COM_LOCATION INTO TMP_TXM; 
EXIT 
WHEN TXM_COM_LOCATION%NOTFOUND; 

IF NOT TX_COM_LOCATION%ISOPEN 
THEN 
OPEN TXCOM_LOCATION; 
END IF; 
LOOP FETCH TX_COM_LOCATION INTO TMP_TX; EXIT WHEN TX_COM_LOCATION%NOTFOUND; 
BEGIN Insert statement() 
END; 
END LOOP; 
END LOOP; 
commit; 
END; 
END COM_LOCATION_TXM ;