日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Oracle數(shù)據(jù)庫在存儲過程中經(jīng)常出現(xiàn)的若干問題

以下的文章主要是對Oracle數(shù)據(jù)庫在存儲過程中出現(xiàn)的若干問題的深入討論,如果你想對Oracle數(shù)據(jù)庫在存儲過程中出現(xiàn)的若干問題有個詳細(xì)了解的話,以下就是詳細(xì)內(nèi)容的描述,希望在你今后的學(xué)習(xí)中會有所幫助。

創(chuàng)新互聯(lián)建站客戶idc服務(wù)中心,提供服務(wù)器機柜租用、成都服務(wù)器、成都主機托管、成都雙線服務(wù)器等業(yè)務(wù)的一站式服務(wù)。通過各地的服務(wù)中心,我們向成都用戶提供優(yōu)質(zhì)廉價的產(chǎn)品以及開放、透明、穩(wěn)定、高性價比的服務(wù),資深網(wǎng)絡(luò)工程師在機房提供7*24小時標(biāo)準(zhǔn)級技術(shù)保障。

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

 
 
 
  1. select a.appname from appinfo a; 

正確

 
 
 
  1. select a.appname from appinfo as a; 

錯誤。也許,是怕和Oracle中的存儲過程中的關(guān)鍵字as沖突的問題吧

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

 
 
 
  1. select af.keynode into kn from APPFOUNDATION af where 
    af.appid=aid and af.foundationid=fid; 

有into,正確編譯

 
 
 
  1. select af.keynode from APPFOUNDATION af where 
    af.appid=aid and af.foundationid=fid; 

沒有into,編譯報錯,提示:Compilation

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

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

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

4.在存儲過程中,別名不能和字段名稱相同,否則雖然編譯可以通過,但在運行階段會報錯

 
 
 
  1. select keynode into kn from APPFOUNDATION where appid=aid and foundationid=fid; 

正確運行

 
 
 
  1. select af.keynode into kn from APPFOUNDATION af where af.appid=appid and af.foundationid=foundationid; 

運行階段報錯,提示

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

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

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

 
 
 
  1. create table A(  
  2. id varchar2(50) primary key not null,  
  3. vcount number(8) not null,  
  4. bid varchar2(50) not null   

外鍵

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

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

 
 
 
  1. if fcount is null then  
  2. fcount:=0;  

end if;這樣就一切ok了。

6.Hibernate調(diào)用Oracle存儲過程

 
 
 
  1. this.pnumberManager.getHibernateTemplate().execute(  
  2. new HibernateCallback() ...{  
  3. public Object doInHibernate(Session session)  
  4. throws HibernateException, SQLException ...{  
  5. CallableStatement cs = session 
  6. .connection()  
  7. .prepareCall("{call modifyapppnumber_remain(?)}");  
  8. cs.setString(1, foundationid);  
  9. cs.execute();  
  10. return null;  
  11. }  
  12. });  

延伸閱讀:

詳細(xì)講解 DB2 9存儲過程的規(guī)劃和實施技

Oracle數(shù)據(jù)庫與SQL Server選型時注意的三個差異

Oracle 10g ASM 的一點經(jīng)驗

Oracle 9i和10g在create index和rebuild index的統(tǒng)計信息的區(qū)別

文章出自:http://www.programbbs.com/doc/4831.htm


分享標(biāo)題:Oracle數(shù)據(jù)庫在存儲過程中經(jīng)常出現(xiàn)的若干問題
網(wǎng)頁路徑:http://m.5511xx.com/article/ccscpoi.html