久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

關于oracle存儲過程的若干問題備忘

瀏覽:3日期:2023-11-20 15:38:05
1.在Oracle中,數據表別名不能加as,如:關于oracle存儲過程的若干問題備忘select;a.appname;from;appinfo;a;-- 正確關于oracle存儲過程的若干問題備忘select;a.appname;from;appinfo;as;a;-- 錯誤;;也許,是怕和oracle中的存儲過程中的要害字as沖突的問題吧;2.在存儲過程中,select某一字段時,后面必須緊跟into,假如select整個記錄,利用游標的話就另當別論了。關于oracle存儲過程的若干問題備忘select;af.keynode;into;kn;from;APPFOUNDATION;af;where;af.appid=aid;and;af.foundationid=fid;--;有into,正確編譯關于oracle存儲過程的若干問題備忘select;af.keynode;from;APPFOUNDATION;af;where;af.appid=aid;and;af.foundationid=fid;--;沒有into,編譯報錯,提示:Compilation;關于oracle存儲過程的若干問題備忘Error:;PLS-00428:;an;INTO;clause;is;eXPected;in;this;SELECT;statement關于oracle存儲過程的若干問題備忘關于oracle存儲過程的若干問題備忘;3.在利用select...into...語法時,必須先確保數據庫中有該條記錄,否則會報出'no data found'異常。可以在該語法之前,先利用select count(*) from 查看數據庫中是否存在該記錄,假如存在,再利用select...into...4.在存儲過程中,別名不能和字段名稱相同,否則雖然編譯可以通過,但在運行階段會報錯關于oracle存儲過程的若干問題備忘select;keynode;into;kn;from;APPFOUNDATION;where;appid=aid;and;foundationid=fid;--;正確運行關于oracle存儲過程的若干問題備忘select;af.keynode;into;kn;from;APPFOUNDATION;af;where;af.appid=appid;and;af.foundationid=foundationid;--;運行階段報錯,提示關于oracle存儲過程的若干問題備忘ORA-01422:exact;fetch;returns;more;than;requested;number;of;rows關于oracle存儲過程的若干問題備忘;5.在存儲過程中,關于出現null的問題 假設有一個表A,定義如下:關于oracle存儲過程的若干問題備忘create;table;A(關于oracle存儲過程的若干問題備忘id;varchar2(50);primary;key;not;null,關于oracle存儲過程的若干問題備忘vcount;number(8);not;null,關于oracle存儲過程的若干問題備忘bid;varchar2(50);not;null;--;外鍵;關于oracle存儲過程的若干問題備忘);假如在存儲過程中,使用如下語句:關于oracle存儲過程的若干問題備忘select;sum(vcount);into;fcount;from;A;where;bid='xxxxxx';假如A表中不存在bid='xxxxxx'的記錄,則fcount=null(即使fcount定義時設置了默認值,如:fcount number(8):=0依然無效,fcount還是會變成null),這樣以后使用fcount時就可能有問題,所以在這里最好先判定一下:關于oracle存儲過程的若干問題備忘if;fcount;is;null;then關于oracle存儲過程的若干問題備忘fcount:=0;關于oracle存儲過程的若干問題備忘end;if;這樣就一切ok了。6.Hibernate調用oracle存儲過程關于oracle存儲過程的若干問題備忘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;}});
標簽: Oracle 數據庫
主站蜘蛛池模板: 贵溪市| 寿光市| 乳源| 望奎县| 沈丘县| 咸宁市| 湟源县| 那曲县| 鄢陵县| 宝山区| 黑河市| 大竹县| 清流县| 陕西省| 葫芦岛市| 水城县| 密山市| 团风县| 陇南市| 隆化县| 尉氏县| 湘潭县| 苗栗县| 太原市| 巩义市| 常宁市| 东宁县| 安图县| 介休市| 城步| 灵寿县| 贡觉县| 万载县| 青岛市| 集安市| 汉沽区| 申扎县| 固镇县| 景泰县| 桂阳县| 东丽区|