Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Executing stored procedure within trigger
Jeff Barnett wrote:
>
> I've create & compiled a stored procedure in 7.1.5 successfully as well
> as granted access to public. I'm now wanting to call that procedure
> from within a trigger. Below is the script for creating the trigger.
>
> *****
> CREATE OR REPLACE TRIGGER AVI_VEH_MASTER_AFT_INS
> AFTER INSERT ON AVI_VEH_MASTER
> REFERENCING NEW AS NEW OLD AS OLD
> FOR EACH ROW
> BEGIN
>
> EXECUTE ADD_COMPONENT( NEW.C_KTP_VIN );
>
> END;
> /
> *****
> When I run the script I get the following error.
>
> *****
> CREATE OR REPLACE TRIGGER AVI_VEH_MASTER_AFT_INS
> *
> ERROR at line 1:
> ORA-06550: line 6, column 12:
> PLS-00103: Encountered the symbol "ADD_COMPONENT" when expecting one of
> the
> following:
> := . ( @ % ;
> Resuming parse at line 6, column 42.
> *****
When PL/SQL comes across the word 'execute', it thinks you are referring to an object called 'execute'. Simply remove that word and it will work (at least, it will call ADD_COMPONENT -- we assume *it* works).
i.e:
begin
Add_Component( :new.c_ktp_vin );
end;
Only use EXECUTE when you want to directly call the procedure from SQL*Plus.
-- Tomm Carr -- "Can you describe your assailant?" "No problem, Officer. That's exactly what I was doing when he hit me!"Received on Tue Jul 22 1997 - 00:00:00 CDT