【发布时间】:2015-06-18 05:48:52
【问题描述】:
--这是我的功能
create or replace
function sal_incr
(
p_grade number)
return number
is
v_inc number;
begin
select raise_percent into v_inc
from sal_inc
where grade_id in (select grade_id from emp_task where grade_id = p_grade);
return v_inc;
end;
-- 更新声明
update emp_task set sal = sal + sal_incr(grade_id);
-- 错误堆栈
Error starting at line 15 in command:
update emp_task set sal = sal + sal_incr(grade_id)
Error at Command Line:15 Column:32
Error report:
SQL Error: ORA-06575: Package or function SAL_INCR is in an invalid state
06575. 00000 - "Package or function %s is in an invalid state"
*Cause: A SQL statement references a PL/SQL function that is in an
invalid state. Oracle attempted to compile the function, but
detected errors.
*Action: Check the SQL statement and the PL/SQL function for syntax
errors or incorrectly assigned, or missing, privileges for a
referenced object.
【问题讨论】:
-
编译函数时遇到什么错误?
-
@Prabha 请确保在发布之前正确格式化您的代码,未格式化的代码使调试变得非常困难并且几乎不可读。我已经编辑了您的问题,请以后自己编辑。
-
错误很明显,你的函数有编译错误并且它处于无效状态。打开 SQL*Plus,连接数据库,编译函数,执行
SHOW ERRORS,通过编辑您的问题复制和粘贴整个会话。
标签: oracle function plsql sql-update