警告:在 plsql 中创建包体时出现编译错误...
Posted
技术标签:
【中文标题】警告:在 plsql 中创建包体时出现编译错误...【英文标题】:Warning: Package Body created with compilation errors...in plsql 【发布时间】:2020-08-21 12:01:05 【问题描述】:错误:
警告:包体创建时出现编译错误。 开始 * 第 1 行的错误: ORA-04063: 包体“P12284.EMP_DESIGNATION”有错误 ORA-06508: PL/SQL: 找不到被调用的程序单元: “P12284.EMP_DESIGNATION” ORA-06512: 在第 2 行
如何解决这个问题?请帮助我,我是 PL/SQL 新手
`
set serveroutput on;
CREATE OR REPLACE PACKAGE EMP_DESIGNATION
AS
PROCEDURE EMP_DETAILS(PS_design employee.designation%TYPE, PS_incentive number);
END EMP_DESIGNATION;
/
CREATE OR REPLACE PACKAGE BODY EMP_DESIGNATION
AS
PROCEDURE EMP_DETAILS(design employee.designation%TYPE, incentive number)
IS
BEGIN
update employee set employee.salary = employee.salary + incentive where designation = design ;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' employee(s) are updated');
END;
/
`
【问题讨论】:
你好 Ankit,在命令行上调试 pl/sql 包是一个挑战。我建议你使用像 SQL Developer 这样的工具(它是免费的),在定位问题时让你的生活更轻松。 【参考方案1】:你有两个问题,
emp_details
的签名应在规范和正文中匹配
你忘记end
包体中的过程了。
CREATE OR REPLACE PACKAGE emp_designation AS
PROCEDURE emp_details
(
ps_design employee.designation%TYPE
, ps_incentive NUMBER
);
END emp_designation;
/
CREATE OR REPLACE PACKAGE BODY emp_designation AS
PROCEDURE emp_details
(
ps_design employee.designation%TYPE
, ps_incentive NUMBER
)
IS
BEGIN
UPDATE employee SET employee.salary = employee.salary + ps_incentive
WHERE designation = ps_design;
dbms_output.put_line(SQL%ROWCOUNT || ' employee(s) are updated');
END emp_details;
END;
/
【讨论】:
非常感谢....!!! 花费您宝贵的时间来看看我的问题.... 没问题:)。如果它解决了您的问题,您可以接受答案并打勾:)【参考方案2】:你也需要结束你的包体 -
CREATE OR REPLACE PACKAGE BODY EMP_DESIGNATION
AS
PROCEDURE EMP_DETAILS(design employee.designation%TYPE, incentive number)
IS
BEGIN
update employee set employee.salary = employee.salary + incentive where designation = design ;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' employee(s) are updated');
END;
END EMP_DESIGNATION;
/
【讨论】:
以上是关于警告:在 plsql 中创建包体时出现编译错误...的主要内容,如果未能解决你的问题,请参考以下文章