CREATE OR REPLACE PROCEDURE 存儲過程名字
(
參數
參數
) IS
變量
變量
BEGIN
END 存儲過程名字
將select查詢的結果存入到變量中
記錄
例子
BEGIN
SELECT col
EXCEPTION
WHEN NO_DATA_FOUND THEN
xxxx;
END;
IF V_TEST=
BEGIN
do something
END;
END IF;
WHILE V_TEST=
BEGIN
XXXX
END;
END LOOP;
V_TEST :=
IS
CURSOR cur IS SELECT * FROM xxx;
BEGIN
FOR cur_result in cur LOOP
BEGIN
V_SUM :=cur_result
END;
END LOOP;
END;
CURSOR C_USER(C_ID NUMBER) IS SELECT NAME FROM USER WHERE TYPEID=C_ID;
OPEN C_USER(變量值);
LOOP
FETCH C_USER INTO V_NAME;
EXIT FETCH C_USER%NOTFOUND;
do something
END LOOP;
CLOSE C_USER;
連接數據庫後建立一個Test WINDOW
在窗口輸入調用SP的代碼
關於oracle存儲過程的若干問題備忘
select a
select a
也許
select af
select af
Error: PLS
可以在該語法之前
select keynode into kn from APPFOUNDATION where appid=aid and foundationid=fid;
select af
ORA
假設有一個表A
create table A(
id varchar
vcount number(
bid varchar
);
如果在存儲過程中
select sum(vcount) into fcount from A where bid=
如果A表中不存在bid=
if fcount is null then
fcount:=
end if;
這樣就一切ok了
this
new HibernateCallback()
public Object doInHibernate(Session session)
throws HibernateException
CallableStatement cs = session
nnection()
cs
cs
return null;
}
});
From:http://tw.wingwit.com/Article/program/Oracle/201311/16725.html