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