| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Trigger (PLS-00201: identifier '...' must be declared)
Pete schrieb:
> Hi!
>
> I´m new to Oracle and have a problem when i try to create a trigger.
> Is it possible to reference the values that should be inserted?
> If yes, how is it possible?
>
> Here is my code:
>
> --
>
> CREATE OR REPLACE TRIGGER test_trigger_fik
> BEFORE INSERT
> ON flight_intervals
> REFERENCING new inserted
> FOR EACH ROW
>
> DECLARE
> la_time flight_intervals.arrival_time%TYPE;
> d_time flight_intervals.arrival_time%TYPE;
> la_airport flight_intervals.from_airport%TYPE;
> d_airport flight_intervals.from_airport%TYPE;
> f_id flight_intervals.flight_id%TYPE;
>
> BEGIN
> f_id := inserted.flight_id;
> SELECT MIN(arrival_time) INTO la_time
> FROM flight_intervals
> WHERE flight_id = f_id
> ORDER BY arrival_time;
> IF SQL%NOTFOUND
> THEN la_time := inserted.arrival_time;
> END IF;
>
> ....
>
> END;
> /
> show error;
>
> exit;
>
> --
>
> I always reveive the following errors:
> 9/2 PL/SQL: Statement ignored
> 9/10 PLS-00201: identifier 'INSERTED.FLIGHT_ID' must be declared
> 15/8 PL/SQL: Statement ignored
> 15/19 PLS-00201: identifier 'INSERTED.ARRIVAL_TIME' must be declared
>
> Can anyone help me?
>
> Thanks!
> Pete
>
>
>
>
Try to replace in trigger body "inserted" through ":inserted"
Best regards
Maxim Received on Mon Jun 06 2005 - 16:34:28 CDT
![]() |
![]() |