Procedure fails to DISPLAY dbms_output.put_line
Hi there,
I am new to procedures and having difficulty getting it to display the dbms_output.put_line. Has anyone seen this before if so your assistance would be greatly appreciated..
I have SET SERVEROUT ON TERM ON, created all the necessary tables with data, the procedure does input the data into the former_emp"(as below).
What I fail to understand is why on this procedure(and all others that I write) they work but I get only:
"PL/SQL procedure successfully completed."
Like with the below procedure if I put in a bogus empno = 9999 it still just says:
"PL/SQL procedure successfully completed."
never a dbms_output.putline displayed saying "'Employee Number Not Found!".
I have given my self all privs of SYS and SYSTEM on my schema but nothing seems to work.
Please help....
Thanks in Advance
k
CREATE OR REPLACE PROCEDURE FIRE_EMPLOYEE (p_empno in
number)
AS
v_ename EMP.ENAME%TYPE;
BEGIN
SELECT ename
INTO v_ename
FROM emp
WHERE empno =p_empno;
INSERT INTO former_emp (empno,ename)
VALUES (p_empno,v_ename);
DELETE FROM emp
WHERE empno =p_empno;
UPDATE former_emp
SET date_deleted =SYSDATE
WHERE empno =p_empno;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Employee Number Not Found!');
END;
/
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ---------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-12-1980 800 20
7499 ALLEN SALESMAN 7698 20-02-1981 1600 300 30
7521 WARD SALESMAN 7698 22-02-1981 1250 500 30
7566 JONES MANAGER 7839 02-04-1981 2975 20
7698 BLAKE MANAGER 7839 01-05-1981 2850 30
7782 CLARK MANAGER 7839 09-06-1981 2450 24500 10
7788 SCOTT ANALYST 7566 19-04-1987 3000 20
7839 KING PRESIDENT 17-11-1981 5000 50000 10
7844 TURNER SALESMAN 7698 08-09-1981 1500 0 30
7876 ADAMS CLERK 7788 23-05-1987 1100 20
7900 JAMES CLERK 7698 03-12-1981 950 30
7902 FORD ANALYST 7566 03-12-1981 3000 20
7934 MILLER CLERK 7782 23-01-1982 1300 13000 10
1234 ADAMS 3500
14 rows selected.
SQL> exec fire_employee (1234);
PL/SQL procedure successfully completed.
SQL> select * from former_emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO DATE_DELET
---------- ---------- --------- ---------- ---------- ---------- ---------- ---------- ----------
7654 MARTIN 19-01-2002
1234 ADAMS 20-01-2002
SQL>