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数据库,如下图所示。