Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: Subqueries in triggers...
> CREATE OR REPLACE TRIGGER TGR_CHK_ENT_ID_Type
> BEFORE
> INSERT OR UPDATE OF ENT_KWD_ID_Type
> ON tEntity
> FOR EACH ROW
>
> DECLARE
>
> CURSOR CRS_Keyword IS
> SELECT UPPER(KWD_Section) KWD_Section
> FROM tKeyword
> WHERE KWD_ID = :NEW.ENT_KWD_ID_Type;
>
> REC_Keyword CRS_Keyword%ROWTYPE;
>
> BEGIN
>
> OPEN CRS_Keyword;
> FETCH CRS_Keyword INTO REC_Keyword;
>
> IF REC_Keyword.KWD_Section != 'ENTITYTYPE'
> THEN
> RAISE_APPLICATION_ERROR
> (-20000,'Invalid KWD_ID for ENT_KWD_ID_Type!');
> END IF;
>
> END;
>
I hope you will think about closing a cursor in the futur!!!!!!!!
The DBA will not like you otherwise. :)
Received on Fri Nov 01 2002 - 17:27:48 CST