色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

深入探討Oracle數(shù)據(jù)庫存儲(chǔ)過程的若干問題

瀏覽:131日期:2023-11-23 10:18:45

1.在oracle中,數(shù)據(jù)表別名不能加as,如:

select a.appname from appinfo a;-- 正確

select a.appname from appinfo as a;-- 錯(cuò)誤

也許,是怕和oracle中的存儲(chǔ)過程中的關(guān)鍵字as沖突的問題吧

2.在存儲(chǔ)過程中,select某一字段時(shí),后面必須緊跟into,如果select整個(gè)記錄,利用游標(biāo)的話就另當(dāng)別論了。

select af.keynode into kn from APPFOUNDATION af where af.appid=aid and af.foundationid=fid;-- 有into,正確編譯

select af.keynode from APPFOUNDATION af where af.appid=aid and af.foundationid=fid;-- 沒有into,編譯報(bào)錯(cuò),提示:Compilation

Error: PLS-00428: an INTO clause is expected in this Select statement

3.在利用select...into...語法時(shí),必須先確保數(shù)據(jù)庫中有該條記錄,否則會(huì)報(bào)出'no data found'異常。

可以在該語法之前,先利用select count(*) from 查看數(shù)據(jù)庫中是否存在該記錄,如果存在,再利用select...into...

4.在存儲(chǔ)過程中,別名不能和字段名稱相同,否則雖然編譯可以通過,但在運(yùn)行階段會(huì)報(bào)錯(cuò)

select keynode into kn from APPFOUNDATION where appid=aid and foundationid=fid;-- 正確運(yùn)行

select af.keynode into kn from APPFOUNDATION af where af.appid=appid and af.foundationid=foundationid;-- 運(yùn)行階段報(bào)錯(cuò),提示

orA-01422:exact fetch returns more than requested number of rows

5.在存儲(chǔ)過程中,關(guān)于出現(xiàn)null的問題

假設(shè)有一個(gè)表A,定義如下:

create table A(

id varchar2(50) primary key not null,

vcount number(8) not null,

bid varchar2(50) not null -- 外鍵

);如果在存儲(chǔ)過程中,使用如下語句:

select sum(vcount) into fcount from A where bid='xxxxxx';如果A表中不存在bid='xxxxxx'的記錄,則fcount=null(即使fcount定義時(shí)設(shè)置了默認(rèn)值,如:fcount number(8):=0依然無效,fcount還是會(huì)變成null),這樣以后使用fcount時(shí)就可能有問題,所以在這里最好先判斷一下:

if fcount is null then

fcount:=0;

end if;這樣就一切ok了。

6.Hibernate調(diào)用oracle存儲(chǔ)過程

this.pnumberManager.getHibernateTemplate().execute(

new HibernateCallback() ...{

public Object doInHibernate(Session session)

throws HibernateException, SQLException ...{

CallableStatement cs = session

.connection()

.prepareCall('{call modifyapppnumber_remain(?)}');

cs.setString(1, foundationid);

cs.execute();

return null;

}

});

標(biāo)簽: Oracle 數(shù)據(jù)庫
主站蜘蛛池模板: 女人张开腿等男人桶免费视频 | 国产成人精品日本亚洲语音1 | 国产亚洲一区二区手机在线观看 | aaa一级毛片免费 | 亚洲综合精品成人 | 国产成人一区二区在线不卡 | 欧美一级成人一区二区三区 | 99热免费 | 成人免费午间影院在线观看 | 精品国产日韩亚洲一区在线 | 2000xxxxav影院| 久久午夜精品视频 | 国产成人精品女人不卡在线 | 高清欧美一级在线观看 | 亚洲美女性视频 | 日本韩国一级毛片中文字幕 | 精品91一区二区三区 | 亚洲国产精品一区二区第四页 | 久久草在线免费 | 午夜性a一级毛片 | 男人女人做黄刺激性视频免费 | 中国黄色一级大片 | 久久久免费网站 | 国产精品福利视频萌白酱 | 99热久久国产综合精品久久国产 | 男人添女人下面免费毛片 | 国产性生交xxxxx免费 | 成人久久精品一区二区三区 | 精品国产三级a∨在线 | 美女午夜色视频在线观看 | 亚洲欧美国产一区二区三区 | 国产亚洲欧美在线人成aaaa | 国产乱子伦视频大全 | 国产高清免费 | 日韩国产欧美一区二区三区在线 | 91aaa免费免费国产在线观看 | 男人天堂视频网 | 欧美国产综合视频 | 欧美一级毛片欧美大尺度一级毛片 | 亚洲成a人片毛片在线 | 亚洲欧美视频在线 |