Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: Subqueries in triggers...

Re: PL/SQL: Subqueries in triggers...

From: Carsten Alexander <acamat_at_web.de>
Date: Fri, 1 Nov 2002 16:55:20 -0000
Message-ID: <apu85k$4qr97$1@ID-86275.news.dfncis.de>


Hi Peter,

"Peter" <depend3_at_yahoo.com> wrote in message news:sCww9.190496$8o4.30261_at_afrodite.telenet-ops.be...

> I'm sorry if this might sound rude, but I think your problem is that you do
> not distinguish between SQL and PL/SQL. You use typical SQL expressions in
> an PL/SQL context.

That doesn't sound rude to me at all, because you're right. The first steps in PL/SQL are hard and somehow confusing to me and I am to be working at that.

> Try the following.

With some slight modifications (see below) it work's fine. Compared with my one it seems to be more straight and elegant...

--
Thanks,
Carsten

CREATE OR REPLACE TRIGGER TGR_CHK_ENT_KWD_ID_Type
BEFORE
INSERT OR UPDATE OF ENT_KWD_ID_Type ON tEntity
FOR EACH ROW
DECLARE
   ID_TEST number;
BEGIN
    BEGIN
       SELECT 1 INTO ID_TEST
           FROM tKeyword
           WHERE UPPER(KWD_Section)='ENTITYTYPE'
              AND :NEW.ENT_KWD_ID_Type  = KWD_ID;
    EXCEPTION
       WHEN NO_DATA_FOUND THEN
          RAISE_APPLICATION_ERROR
           (-20000,'Invalid KWD_ID for ENT_KWD_ID_Type!');
     END;
END;
Received on Fri Nov 01 2002 - 10:55:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US