-2
- 這是我的功能如何解決函數編譯錯誤?
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語句
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.
當您嘗試編譯函數時會得到什麼錯誤? – pablomatico
@Prabha請確保在發佈之前正確地設置好代碼的格式,無格式的代碼會使其非常難以調試並且幾乎無法讀取。我編輯了你的問題,今後請自己做。 –
錯誤很明顯,你的函數有**編譯錯誤**,它處於**無效狀態**。打開SQL * Plus,連接數據庫,編譯函數,執行'SHOW ERRORS',通過編輯你的問題複製並粘貼整個會話。 –