Viewing Errors in a Procedure
SHOW ERRORS command shows errors in your procedure.
CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
SAL NUMBER(7, 2),
DEPTNO NUMBER(2));
INSERT INTO EMP VALUES (1, 'SMITH', 'CLERK', 800, 20);
INSERT INTO EMP VALUES (2, 'ALLEN', 'SALESMAN', 1600, 30);
INSERT INTO EMP VALUES (3, 'WARD', 'SALESMAN', 1250, 30);
INSERT INTO EMP VALUES (4, 'JONES', 'MANAGER', 2975, 20);
SQL> CREATE PROCEDURE update_salary(p_id IN emp.empno%TYPE,p_factor IN NUMBER) AS
2 v_count INTEGER;
3 BEGIN
4 SELECT COUNT(*) INTO v_count FROM emp WHERE empno = p_id;
5
6 IF v_count = 1 THEN
7 UPDATE emp SET sal_NOTRIGHT = sal * p_factor WHERE empno = p_id;
8 COMMIT;
9 END IF;
10 EXCEPTION
11 WHEN OTHERS THEN
12 ROLLBACK;
13 END update_salary;
14 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE UPDATE_SALARY:
LINE/COL ERROR
-------- -----------------------------------------------------------------
7/7 PL/SQL: SQL Statement ignored
7/22 PL/SQL: ORA-00904: "SAL_NOTRIGHT": invalid identifier
SQL>
SHOW ERRORS
Home »
Oracle »
PL/SQL »
Oracle »
PL/SQL »
Procedures:
- Creating a Procedure
- Pass parameters using named and mixed notation.
- Information on Procedures
- Dropping a Procedure
- Viewing Errors in a Procedure
Related: