2007-02-26

PL/SQL的游标使用小例

关键字: cursor
sql 代码
  1. set serveroutput on  
  2. declare  
  3.   tempsal scott.emp.sal%type;   
  4.   cursor mycursor is  
  5.      select * from scott.emp   
  6.      where sal>tempsal;   
  7.   cursorrecord mycursor%rowtype;   
  8. begin  
  9.    tempsal:=800;   
  10.    open mycursor;      
  11.    fetch mycursor into cursorrecord;   
  12.    if mycursor%found then  
  13.       dbms_output.put_line(to_char(mycursor%rowcount));   
  14.    else  
  15.       dbms_output.put_line('没有找到数据');   
  16.    end if ;     
  17. end;         
评论
发表评论

您还没有登录,请登录后发表评论

sprite
搜索本博客
最近访客
最近加入圈子
存档
最新评论