Oracle 遊標

guifx027發表於2010-11-05
Create or replace procedure p_test(ai_errorcode out integer, ai_errortext out varchar)
as
cursor cur_tabname is
Select * From tabname;

rec_tabname tabname%rowtype;
BEGIN
ai_errorcode := 1;
ai_errortext := 'OK';

open cur_tabname;
loop
<>
fetch cur_tabname into rec_tabname;
exit when cur_tabname%notfound;

--此處為要在遊標裡執行的語句塊
Select Count(*) Into li_count From tabname Where 1=1;
if ll_count > 0 then
goto loopcontinue;
Else
--處理語句
END IF;
END LOOP;
CLOSE cur_tabname;

Return;

END p_test;
[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10018906/viewspace-1040990/,如需轉載,請註明出處,否則將追究法律責任。

相關文章