set serveroutput on--开启显示功能

declare
 varID varchar(11);--定义变量
 varName varchar(12);
cursor myCur(varNumber number) is
select empno,ename from emp where empno=varNumber;
begin
open myCur(7900);--打开游标
fetch myCur into varID,varName;--读取当前游标的数据
close myCur;--关闭游标

dbms_output.put_line('empno:'||varID||'empname:'||varName);
end;
/