SQL Server:
declare @name varchar(30);  
declare my_cursor SCROLL cursor for select ProductName from kuailegu.tb_Product;  
open my_cursor;  
fetch my_cursor into @name;  
WHILE (@@fetch_status = 0) 
begin  
FETCH NEXT FROM my_cursor INTO @name;  
print @name;  
end  
CLOSE my_cursor  
DEALLOCATE my_cursor

 

Oracle版本:  
  declare  
      cursor   getrecord   is   select   name   from   table;  
      myname   vachar2(30);  
  begin  
      open   getrecord;  
      loop    
            fetch   getrecord   into   myname;  
            exIT   when   getrecord%notfound;  
            ....  
      end   loop;  
      close   getrecord;  
  end;

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
猜你喜欢
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2021-11-29
  • 2021-10-20
  • 2022-01-05
相关资源
相似解决方案