Oracle 循环

foreach 循环

declare
cursor cur is
select * from “m_user”;
urow “m_user”%rowtype;
begin
dbms_output.enable(1000000);
for urow in cur
loop
dbms_output.put_line(‘id=’||urow.”id”);
end loop;
end;

for循环

FOR REC IN (SELECT * FROM DUAL) LOOP

END LOOP;

DECLARE
str Varchar(10);– 定义一个字符串变量str
BEGIN
str := ‘123’;

for i in 1 .. 100 loop
sys.dbms_output.put_line(str || i);– 打印该字符串
end loop;
commit;
END;

You may also like...

发表回复