Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Triggers and default values problem
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