---
title: "PL/SQL的游标使用小例"
author: "sprite"
date: "2007-02-26T16:02:05Z"
tags: []
slug: "pl-sql"
draft: false
lastmod: "2007-02-26T16:02:05Z"
id: 55896
url: "https://sprite.iteye.com/blog/55896"
---

sql 代码

01. set serveroutput on
02. declare
03. tempsal scott.emp.sal%type;
04. cursor mycursor is
05. select * from scott.emp
06. where sal&gt;tempsal;
07. cursorrecord mycursor%rowtype;
08. begin
09. 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;