Showing Errors in ttIsql
You can use the show errors
command in ttIsql
to see details about errors you encounter in executing anonymous blocks or compiling packages, procedures, or functions.
This is shown in the following example.
Again consider the example in Creating and Using Packages. Assume the same package specification shown there, which declares the procedures and functions hire_employee
, remove_employee
, and num_above_salary
. But instead of the body definition shown there, consider the following, which defines hire_employee
and num_above_salary
but not remove_employee
:
CREATE OR REPLACE PACKAGE BODY emp_actions AS
-- Code for procedure hire_employee:
PROCEDURE hire_employee (employee_id NUMBER,
last_name VARCHAR2,
first_name VARCHAR2,
email VARCHAR2,
phone_number VARCHAR2,
hire_date DATE,
job_id VARCHAR2,
salary NUMBER,
commission_pct NUMBER,
manager_id NUMBER,
department_id NUMBER) IS
BEGIN
INSERT INTO employees VALUES (employee_id,
last_name,
first_name,
email,
phone_number,
hire_date,
job_id,
salary,
commission_pct,
manager_id,
department_id);
END hire_employee;
-- Code for function num_above_salary:
FUNCTION num_above_salary (emp_id NUMBER) RETURN NUMBER IS
emp_sal NUMBER(8,2);
num_count NUMBER;
BEGIN
SELECT salary INTO emp_sal FROM employees
WHERE employee_id = emp_id;
SELECT COUNT(*) INTO num_count FROM employees
WHERE salary > emp_sal;
RETURN num_count;
END num_above_salary;
END emp_actions;
/
Attempting this body definition after the original package specification results in the following:
Warning: Package body created with compilation errors.
To get more information, run ttIsql
and use the command show errors
. In this example, show errors
provides the following:
Command> show errors;
Errors for PACKAGE BODY EMP_ACTIONS:
LINE/COL ERROR
-------- -----------------------------------------------------------------
13/13 PLS-00323: subprogram or cursor 'REMOVE_EMPLOYEE' is declared in a
package specification and must be defined in the package body