成人视屏在线观看-国产99精品-国产精品1区2区-欧美一级在线观看-国产一区二区日韩-色九九九

您的位置:首頁技術(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ù)庫
主站蜘蛛池模板: 亚洲小视频网站 | 一区二区三区在线观看视频 | 国产一区二区免费在线观看 | 国产呦系列呦 | 久久精品成人国产午夜 | 韩国福利一区 | 日本特黄特色高清免费视频 | 久久精品国产免费看久久精品 | 免费国产成人高清视频网站 | 欧美三级视频在线观看 | 毛片手机在线视频免费观看 | 日韩综合网站 | 日韩欧美中文字幕在线观看 | 萌白酱喷水福利视频在线 | 在线国产一区二区 | 玖玖精品在线视频 | www.91成人| 欧美顶级毛片在线播放 | 亚洲午夜网站 | 在线亚洲一区二区 | 亚洲图片一区二区三区 | 久久精品国产福利 | 免费观看a黄一级视频 | 午夜影院黄 | 亚洲加勒比久久88色综合一区 | 亚洲香蕉久久一区二区 | 男女免费爽爽爽在线视频 | 日韩成人毛片高清视频免费看 | 日本阿v视频在线观看高清 日本波多野结衣视频 | 国产一在线精品一区在线观看 | 国产步兵社区视频在线观看 | 国产亚洲精品高清在线 | 免费一看一级毛片全播放 | 欧美性猛交xxxxxxxx软件 | 毛片免费在线 | 成年人免费视频网站 | 国产视频手机在线 | 色偷偷女男人的天堂亚洲网 | 毛片三级 | 亚洲国产精品综合欧美 | 国产亚洲精品久久久久久久网站 |