日期:2014-05-17  浏览次数:23192 次

Oracle中降序循环的方法???谁知道到
Oracle中用for 循环降序输出的方法????????????

------解决方案--------------------
SQL code

begin
    for i in reverse  1..10
    loop
        dbms_output.put_line(i);
    end loop;
end;
/


SQL> /
 
10
9
8
7
6
5
4
3
2
1
 
PL/SQL procedure successfully completed

------解决方案--------------------
SQL code
begin
  for v_index in reverse 1..10 loop
    dbms_output.put_line(to_char(v_index));
  end loop;
end;