MyTetra Share
Делитесь знаниями!
Matching Package Specification and Body
Время создания: 22.10.2017 09:13
Раздел: PL/SQL - Задачник - Packages
Запись: xintrea/mytetra_db_mcold/master/base/1508652786g0ih2z4rdi/text.html на raw.githubusercontent.com

CREATE PACKAGE emp_bonus AS

PROCEDURE calc_bonus (date_hired employees.hire_date%TYPE);

END emp_bonus;

/

CREATE PACKAGE BODY emp_bonus AS

-- DATE does not match employees.hire_date%TYPE

PROCEDURE calc_bonus (date_hired DATE) IS

BEGIN

DBMS_OUTPUT.PUT_LINE

('Employees hired on ' || date_hired || ' get bonus.');

END;

END emp_bonus;

/

Result:

Warning: Package Body created with compilation errors.

Show errors (in SQL*Plus):

SHOW ERRORS

Result:

Errors for PACKAGE BODY EMP_BONUS:

LINE/COL ERROR

-------- -----------------------------------------------------------------

2/13 PLS-00323: subprogram or cursor 'CALC_BONUS' is declared in a

package specification and must be defined in the package body

Correct problem:

CREATE OR REPLACE PACKAGE BODY emp_bonus AS

PROCEDURE calc_bonus

(date_hired employees.hire_date%TYPE) IS

BEGIN

DBMS_OUTPUT.PUT_LINE

('Employees hired on ' || date_hired || ' get bonus.');

END;

END emp_bonus;

/

Result:

Package body created.

 
MyTetra Share v.0.59
Яндекс индекс цитирования