日期:2014-05-16  浏览次数:20436 次

Oracle游标使用示例

  1. 1.游标处理:
    declare  
    RoomID Room.RoomID%Type;  
    RoomName Room.RoomName%Type;  
    cursor crRoom is  
    select RoomID,RoomName  
    from Room;  
       
    begin  
    open crRoom;loop(这里不要加分号)
    fetch crRoom into RoomID,RoomName;  
    exit when crRoom%notFound;  
    end loop;  
    close crRoom;   
    end; 

    2.游标返回:
    begin
        open rt_cursor for
        select * from dual;    
    end;
    ??