oracle存储过程报错pls103
‘壹’ oracle存储过程中提示 错误:PLS-00103: 出现符号 "FOR"在需要下列之一时
你妹,你那个语法是sql server的语法好伐。。。
oracle语法见下面
declare
cursor v_cur_tmp is
SELECT oc_date,dwbm,kmbm,bzbm,rowid FROM t_gfsindex_indexcontent;
begin
open v_cur_tmp;
loop
fetch v_cur_tmp into v_oc_date, v_cur_dwbm, v_cur_kmbm, v_cur_bzbm,cur_rowid;
exit when v_cur_tmp%NOTFOUND;
;
end loop;
close v_cur_tmp;
end;
‘贰’ ORACLE 存储过程报错 PLS-00103 求查错
其中username ,counter ,rolename 是传入参数,传入参数不能赋值,即第7、8行语句有问题,建议删除。
建议在plsql工具中编辑,方便。
(2)oracle存储过程报错pls103扩展阅读
存储过程(Stored Procere)是在大型数据库系统中,一组为了完成特定功能的SQL 语句集,存储在数据库中,经过第一次编译后再次调用不需要再次编译,用户通过指定存储过程的名字并给出参数(如果该存储过程带有参数)来执行它。存储过程是数据库中的一个重要对象。
‘叁’ 在oracle存储过程时,出现错误:pls-00103:出现符号"insert"在需要下列之一时
as 后要写begin
CREATE OR REPLACE PROCEDURE Bom(Oldid VARCHAR2,
Newid VARCHAR2,
USER VARCHAR2,
Company VARCHAR2) AS
begin
INSERT Cc_Record_Bom
SELECT Sys_Guid(),
Item,
Item_Class,
Item_d,
Item_d_Class,
Net_Qty,
Waste_Qty,
Total_Qty,
Bom_Ver,
Start_Date,
End_Date,
Newid,
Remark,
USER,
SYSDATE,
USER,
SYSDATE,
Company
FROM Cc_Record_Bom
WHERE Code = Oldid;
INSERT Cc_Stand_Bom
SELECT Sys_Guid(),
Item,
Item_d,
Net_Qty,
Waste_Qty,
Total_Qty,
Bom_Ver,
Start_Date,
End_Date,
Newid,
Remark,
USER,
SYSDATE,
USER,
SYSDATE,
Company,
Item_Class,
Item_d_Class
FROM Cc_Stand_Bom
WHERE Code = Oldid;
INSERT Cc_Wo_Bom
SELECT Item,
Item_d,
Net_Qty,
Waste_Qty,
Total_Qty,
Bom_Ver,
Start_Date,
End_Date,
Newid,
Remark,
USER,
SYSDATE,
USER,
SYSDATE,
Company,
Item_Class,
Item_d_Class
FROM Cc_Wo_Bom
WHERE Code = Oldid;
END Bom;
‘肆’ ORACLE存储过程中游标作为输出参数调用时怎么报错
你的意思是不是要获取到“当前用户:user_id”这个的内容,如果是,两个方式可以解决:
1.通过存储过程的出参,将“当前用户:user_id”连接串返回;
比如:
假设你的过程叫,prc_test,在参数列表中增加出参。
create or replace procere prc_test(入参 in 类型, 出参 out 类型) is
begin
-- 逻辑实现
end;
出参就是你要把内容放进去,用来传值的变量。
2.在过程中保存一张临时表,然后在java中查出这个临时表中保存的数据。
定义临时表table_temp
在过程中
insert into table_temp(msg) values ('当前用户:' || user_id);
‘伍’ 链夊叧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