PL/SQL的游标使用小例

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;         

你可能感兴趣的:(sql)