Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How can I use Oracle's :NEW inside my delphi program without referring to host variable?
One of your problems is
END IF;
END IF;
replace it with
END IF;
END;
On the Delphi side I can't help you. Triggers do not return values to a
front-end. Though they can execute a function or stored procedure that can.
Daniel Morgan
Daniele Cincinnati wrote:
> I've got to create (in Oracle) a trigger which refers to field 'myfield' of
> the new inserted row (:NEW.myfield). This trigger is created by means of a
> sql script in delphi language; the sql script is executed by
> TAdoQuery.ExecSql method but :NEW.myfield is treated like a host variable
> and not like the new inserted row! Any idea how I can solve my problem?
> Here is the sql script:
> CREATE TRIGGER trig1 BEFORE INSERT
> ON Table1 FOR EACH ROW
> DECLARE DUMMY INTEGER;
> BEGIN
> SELECT COUNT(*)
> INTO DUMMY
> FROM TA_TERR
> WHERE Id = :NEW.myfield;
> IF DUMMY = 0 THEN
> RAISE_APPLICATION_ERROR( -20501,'Error');
> END IF;
> END IF;
>
> Thanks!
Received on Thu Feb 21 2002 - 11:04:32 CST