Subject | Re: [firebird-support] Re: Are before triggers absolutely reliable? What happens if they fail? |
---|---|
Author | Martijn Tonies |
Post date | 2007-10-29T14:13:32Z |
> > What is the full source of the trigger?Yep, this should work.
>
> Here is the before insert trigger. I have checked the dependencies and
> no other DB object refers to DOC_CREATED_DATE so I assume it must be
> an issue in my front end code?
>
>
> AS
> DECLARE VARIABLE v_Proj_FeeLumpSum NUMERIC(18,2);
> DECLARE VARIABLE v_doc_proj_name VARCHAR(140);
> DECLARE VARIABLE v_doc_proj_desref VARCHAR(12);
> DECLARE VARIABLE v_proj_feepercent FLOAT;
>
> BEGIN
> IF (NEW.DOC_ID IS NULL) THEN
> BEGIN
> NEW.DOC_ID = GEN_ID(GEN_DOC_ID,1);
> END
>
> NEW.DOC_CREATED_DATE = CURRENT_TIMESTAMP;
You could add an additional trigger BEFORE UPDATE/INSERT that if
NEW.DOC_CREATED_DATE is NULL, it would raise an error.
Or simply modify the column to be NOT NULL.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com