db2存儲過程for循環(huán) DB2存儲過程調(diào)用存儲過程?
DB2存儲過程調(diào)用存儲過程?1. 先定義游標(biāo)。2打開光標(biāo)。三。獲取數(shù)據(jù)。4關(guān)閉光標(biāo)。例如:1。Exec SQL為select distinct(cyelc)cursor聲明cacct cursor,從
DB2存儲過程調(diào)用存儲過程?
1. 先定義游標(biāo)。2打開光標(biāo)。三。獲取數(shù)據(jù)。4關(guān)閉光標(biāo)。例如:1。Exec SQL為select distinct(cyelc)cursor聲明cacct cursor,從xxxxx(表名)order按cyelcuid和UR2排序。Exec SQL打開cacct3。While(1){exec SQL fetch cacct into:XXXX(變量名)if(sqlca.sqlcode==100) 破解……}執(zhí)行SQL關(guān)閉cacct
如何執(zhí)行db2存儲過程?
1。DB2創(chuàng)建數(shù)據(jù)庫名稱調(diào)用存儲過程名稱(參數(shù)1,參數(shù)2)5。驗證數(shù)據(jù)插入是否成功。在Windows下:DB2 select count(*)from ftotp DB2 select count(*)from ftotp in USINFOIX DB2 select count(*)from ftotp in userinfo Windows TOKENFOIX下:DB2 select count(*)from ftotp 1。DB2創(chuàng)建數(shù)據(jù)庫名
2。DB2連接到數(shù)據(jù)庫名稱用戶名使用用戶密碼
3。DB2-tvf otpdbuv3udb2。SQL
4。DB2-TD@-f存儲過程文件絕對路徑
4。調(diào)用存儲過程:
windows:DB2 call storage procedure name(參數(shù)1,參數(shù)2)
AIX:DB2
DB2=>call storage procedure name(參數(shù)1,參數(shù)2)
5。驗證插入數(shù)據(jù)是否成功
windows:DB2 select count(*)from ftotp In AIX:DB2
DB2=>select count(*)from ftotp In windows:DB2 select count(*)from ftotp In AIX:DB2
DB2=>select count(*)from ftotp DB2 text search存儲過程的權(quán)限更改:確保實例所有者同時擁有兩個dbadm和數(shù)據(jù)訪問權(quán)限。
從v9.7 FP1和更高版本的修補程序包開始,具有secadm權(quán)限的用戶可以在運行db2ts enable database for text命令時通過指定autogrant選項來授予實例所有者必要的dbadm和dataaccess權(quán)限。在運行DB2文本搜索命令或存儲過程之前,請確保您具有適當(dāng)?shù)奶貦?quán)級別和特權(quán),并且對于所有DB2文本搜索存儲過程,execute特權(quán)被授予public。