首页 > 代码库 > oracle学习--循环语句

oracle学习--循环语句

                               oracle学习--循环语句 


loop循环:create or replace procedure pro_test_loop isi number;begini:=0;loop i:=i+1; dbms_output.put_line(i); if i>5 then exit; end if;end loop;end pro_test_loop;

while循环:create or replace procedure pro_test_while isi number;begini:=0;while i<5 loop  i:=i+1;  dbms_output.put_line(i);end loop;end pro_test_while;

for循环1:create or replace procedure pro_test_for isi number;begini:=0;for i in 1..5 loop  dbms_output.put_line(i);end loop;end pro_test_for;

for循环2:create or replace procedure pro_test_cursor isuserRow t_user%rowtype;cursor userRows isselect * from t_user;beginfor userRow in userRows loop    dbms_output.put_line(userRow.Id||‘,‘||userRow.Name||‘,‘||userRows%rowcount);end loop;end pro_test_cursor;

  

oracle学习--循环语句