SQL에 익숙하지 않아 감사 테이블에 삽입 할 트리거를 만들려고합니다.오라클 트리거가 유효하지 않습니다.
create or replace trigger late_ship_insert
after insert on suborder
for each row
declare
employee int;
begin
select emp_id
into employee
from handles
where order_no = :new.order_no;
if :new.actual_ship_date > :new.req_ship_date then
insert into ship_audit
values (employee, :new.order_no, :new.suborder_no, :new.req_ship_date, :new.actual_ship_date);
end;
오류 :
Warning: execution completed with warning
trigger late_ship_insert Compiled.
그러나 나는 그것이 트리거가 드롭 그것을 작동하지 않습니다 말해 삽입 문을 시도하면.
Error starting at line 1 in command:
insert into suborder
values (8, 3, '10-jun-2012', '12-jul-2012', 'CVS', 3)
Error at Command Line:1 Column:12
Error report:
SQL Error: ORA-04098: trigger 'COMPANY.LATE_SHIP_INSERT' is invalid and failed re-validation
04098. 00000 - "trigger '%s.%s' is invalid and failed re-validation"
*Cause: A trigger was attempted to be retrieved for execution and was
found to be invalid. This also means that compilation/authorization
failed for the trigger.
*Action: Options are to resolve the compilation/authorization errors,
disable the trigger, or drop the trigger.
이 원인을 어떤 생각, 어떤 도움을 크게 감상 할 수있다. 감사!
는'SHOW의 ERRORS'를 수행합니다 (I가
ship_audit
테이블의 C 럼 이름에서 추측하고있어)과 같이 보일 것입니다. –오라클에서'int' 타입을 찾는데 놀랄 것입니다 ... 숫자를 시도해보십시오. –
여러분은'END IF;가 없다고 생각합니다.'선언 한 모든 변수가 처음에 위치해야한다고 생각합니다. – alfasin