Oracle循环语句种类很多,下面就为您详细介绍几种常用的Oracle循环语句的写法,如果您对Oracle循环语句方面感兴趣的话,不妨一看。
loop循环:
createorreplaceprocedurepro_test_loopis inumber; begin i:=0; loop ii:=i+1; dbms_output.put_line(i); ifi>5then exit; endif; endloop; endpro_test_loop;
while循环:
createorreplaceprocedurepro_test_whileis inumber; begin i:=0; whilei<5loop ii:=i+1; dbms_output.put_line(i); endloop; endpro_test_while;
for循环1:
createorreplaceprocedurepro_test_foris inumber; begin i:=0; foriin1..5loop dbms_output.put_line(i); endloop; endpro_test_for;
for循环2:
createorreplaceprocedurepro_test_cursoris userRowt_user%rowtype; cursoruserRowsis select*fromt_user; begin foruserRowinuserRowsloop dbms_output.put_line(userRow.Id||','||userRow.Name||','||userRows%rowcount); endloop; endpro_test_cursor;
相关文章
标签:Oracle