SET SERVEROUTPUT ON;
DECLARE
CURSOR cemp
IS
SELECT esal
FROM emp
ORDER BY esal DESC;
a NUMBER (10) := &a;
sal emp.esal%TYPE;
BEGIN
OPEN cemp;
LOOP
FETCH cemp INTO sal;
DBMS_OUTPUT.put_line (sal);
EXIT WHEN cemp%ROWCOUNT = a OR cemp%NOTFOUND;
END LOOP;
CLOSE cemp;
END;
我已经编写了上面的 pl/sql 程序来显示顶级 'a' 员工的工资。我已经在 sql developer 中执行了代码。但是我没有得到任何输出。代码中有什么问题吗?