我正在尝试做一些事情,例如:
for(int i = 0; i<10; i++)
{
for(int j = 0; j<10; j++)
{
Blah;
}
}
//As you can see each time that there is a different i, j starts at 0 again.
在 Oracle 中使用游标。但如果我是正确的,在我从游标中获取所有行之后,它不会重新启动。有没有办法做到这一点?
这是我的sql:
CREATE OR REPLACE PROCEDURE SSACHDEV.SyncTeleappWithClientinfo
as
teleCase NUMBER;
CURSOR TeleAppCursor
is
Select
distinct(casenbr)
from TeleApp;
CURSOR ClientInfoCursor
is
Select casenbr
from clientinfo
where trim(cashwithappyn) is null;
BEGIN
open TeleAppCursor;
open ClientInfoCursor;
LOOP
fetch TeleAppCursor into teleCase;
EXIT when TeleAppCursor%NOTFOUND;
LOOP
fetch ClientInfoCursor into clientCase;
EXIT when ClientInfoCursor%NOTFOUND;
if clientCase = teleCase then
update ClientInfo
set cashwithappyn = (select cashwithappyn from teleapp where casenbr = clientCase)
where casenbr = clientCase;
break;
end if;
END LOOP;
END LOOP;
END;
我确实在网上查过,但在这方面找不到任何东西。