CREATE OR REPLACE PROCEDURE display_employees2 IS
CURSOR emp_cursor IS
SELECT
FIRST_NAME || ' ' || LAST_NAME AS full_name,
PHONE_NUMBER,
HIRE_DATE,
SALARY
FROM employees2;
v_full_name varchar(100);
v_phone_number employees2.phone_number%TYPE;
v_hire_date employees2.hire_date%TYPE;
v_salary employees2.salary%TYPE;
BEGIN
OPEN emp_cursor;
LOOP
FETCH emp_cursor INTO
v_full_name,
v_phone_number,
v_hire_date,
v_salary;
EXIT WHEN emp_cursor%NOTFOUND;
dbms_output.put_line('Name : ' || v_full_name);
dbms_output.put_line('Phone number : ' || v_phone_number);
dbms_output.put_line('Hire Date : ' || v_hire_date);
dbms_output.put_line('Salary : ' || v_salary);
dbms_output.put_line('--------------------');
END LOOP;
CLOSE emp_cursor;
END display_employees2;
我希望显示我的查询输出
您从匿名块调用您的过程
BEGIN
DBMS_OUTPUT.ENABLE(NULL);
display_employees2;
END
;
/
您可以使用“执行脚本”按钮(alt-X)执行它,“输出”选项卡将自动打开......至少它在这里是这样工作的。