0
我使用的蟾蜍,有一個名爲MyTable
表一個結果,它有一個名爲INFO
柱:
信息
ABCD
EFGH
IJKL
蟾蜍:如何循環的選擇
我需要的是將INFO
的元素一個接一個地完成任務。所以,我認爲我需要的東西,象下面這樣:
foreach (select INFO from MyTable)
print
end
我試圖谷歌,似乎我應該使用光標。所以,我想是這樣的:
DEF msg varchar2(15);
cursor cr is
select info from mytable;
begin
OPEN cr;
loop
FETCH cr into msg;
exit when cr%NOTFOUND;
-- do job
end loop;
CLOSE cr;
end;
但我得到了一個錯誤:
cursor cr is
Error at line 3
ORA-00900: invalid SQL statement
Script Terminated on line 3.