oracle存儲過程fetchinto
❶ 鏈夊叧Oracle瀛樺偍榪囩▼鐨勭浉鍏抽棶棰
銆銆璇︾粏璁茶В鏈夊叧Oracle瀛樺偍榪囩▼鐨勭浉鍏抽棶棰
銆銆 鍦∣racle鏁版嵁搴撲腑 鏁版嵁琛ㄥ埆鍚嶆槸涓嶈兘鍔燼s鐨 渚嬪
銆銆select a appname from appinfo a 鈥斺 姝g『
銆銆select a appname from appinfo as a 鈥斺 閿欒
銆銆娉ㄩ噴 榪欏彲鑳芥槸涓轟簡闃叉㈠拰Oracle鏁版嵁搴撲腑鐨勫瓨鍌ㄨ繃紼嬩腑鐨勫叧閿瀛梐s鍐茬獊鐨勯棶棰
銆銆 鍦ㄥ瓨鍌ㄨ繃紼嬩腑 select鏌愪竴瀛楁墊椂 鍚庨潰蹇呴』緔ц窡into 鍋囧俿elect鏁翠釜璁板綍 鍒╃敤娓告爣鐨勮瘽灝卞彟褰撳埆璁轟簡
銆銆
銆銆select af keynode into kn from APPFOUNDATION af where af appid=aid and af foundationid=fid; 鏈塱nto 姝g『緙栬瘧 select af keynode from APPFOUNDATION af where af appid=aid and af foundationid=fid; 娌℃湁into 緙栬瘧鎶ラ敊 鎻愮ず Compilation Error: PLS : an INTO clause is expected in this SELECT statement
銆銆 鍦ㄦ垜浠鍒╃敤select鈥︹into鈥︹﹁娉曟椂 蹇呴』鍏堢『淇濇暟鎹搴撲腑鏈夎ユ潯璁板綍 鍚﹀垯浼氭姤鍑 no data found 寮傚父
銆銆鍙浠ュ湪璇ヨ娉曚箣鍓 鍏堝埄鐢╯elect count錛*錛 from 鏌ョ湅鏁版嵁搴撲腑鏄鍚﹀瓨鍦ㄨヨ板綍 濡傛灉瀛樺湪 鍐嶅埄鐢╯elect鈥︹into鈥︹
銆銆 璇鋒敞鎰 鍦ㄥ瓨鍌ㄨ繃紼嬩腑 鍒鍚嶄笉鑳藉拰瀛楁靛悕縐扮浉鍚 鍚﹀垯鉶界劧緙栬瘧鍙浠ラ氳繃 浣嗗湪榪愯岀殑闃舵典細鎶ラ敊
銆銆
銆銆select keynode into kn from APPFOUNDATION where appid=aid and foundationid=fid; 姝g『榪愯 select af keynode into kn from APPFOUNDATION af where af appid=appid and af foundationid=foundationid; 榪愯岄樁孌墊姤閿 鎻愮ず ORA :exact fetch returns more than requested number of rows
銆銆 鍦ㄥ瓨鍌ㄨ繃紼嬩腑 鍏充簬鍑虹幇null鐨勯棶棰
銆銆鍋囧傛湁涓涓琛╔ 瀹氫箟濡備笅
銆銆 create table X(id varchar ( ) primary key not null vcount number( ) not null bid varchar ( ) not null 澶栭敭 );
銆銆鍋囧傚湪瀛樺偍榪囩▼涓 浣跨敤濡備笅璇鍙
銆銆select sum錛坴count錛 into fcount from X where bid= xxxxxx 濡傛灉X琛ㄤ腑涓嶅瓨鍦╞id= xxxxxx 鐨勮板綍 鍒檉count=null錛堝嵆浣縡count瀹氫箟鏃惰劇疆浜嗛粯璁ゅ 渚嬪 fcount number錛 錛 = 渚濈劧鏃犳晥 fcount榪樻槸浼氬彉鎴恘ull錛 榪欐牱浠ュ悗浣跨敤fcount鏃跺氨鍙鑳戒細鍑虹幇闂棰 鎵浠ュ湪榪欓噷鎴戜滑鏈濂藉厛鍒ゆ柇涓涓
銆銆
銆銆if fcount is null then fcount:= ; end if;
銆銆 Hibernate璋冪敤Oracle鐨勫瓨鍌ㄨ繃紼
銆銆
銆銆this pnumberManager getHibernateTemplate() execute( new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException SQLException { CallableStatement cs = nnection() prepareCall( {call modifyapppnumber_remain(?)} ); cs setString( foundationid); cs execute(); return null; } });
lishixin/Article/program/Oracle/201311/17685
❷ oracle存儲過程中如何對一個變數累加賦值 最好有個例子
1、首先打開oracle資料庫,如下圖所示。