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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Triggers and default values problem

Re: Triggers and default values problem

From: Charles Bosquet <cbosquet_at_free.fr>
Date: Tue, 19 Sep 2000 09:24:11 GMT
Message-ID: <%gGx5.1553$Qf7.3887309@nnrp1.proxad.net>

Hi,
Thank you for your interest

Well i'll give you a redolent example :

This my Tables :
Article(Code, FamilyCode, Name, Color, ...) , the default value for Color is White
ArticleFamily(Code, DefaultColor, ...), this table contains this record : 'GreenFamily', 'Green', ...

This is a trigger on Article on before insert (Sometime i use this trigger (to import data, then i enable this trigger) :
...

IF :NEW.FamilyCode IS NOT NULL AND :NEW.Color is NULL THEN -- Color is never NULL !!!

    :NEW.Color := -- Color of the FamilyColor with Code = :NEW.FamilyColor
...

END IF;
...

If i do :
insert into Article(Code, Name) values ('MyArticle', 'MyArticleName'), the Color is White
if i do :
insert into Article(Code, FamilyCode, Name) values ('MyArticle', 'GreenFamily', 'MyArticleName'), the Color is White !!!

Regards,
Charles Bosquet APISoft FRANCE Received on Tue Sep 19 2000 - 04:24:11 CDT

Original text of this message

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