Subject | Re: [firebird-support] Re: On Updating One Column Value, Update Time Stamp in Another Column |
---|---|
Author | Vishal Tiwari |
Post date | 2017-08-09T10:36:54Z |
Hi Paul,
You Rocks !!!!!!!n Yes It is working as expected.
I would also like to know that if I need to learn Triggers and Stored Procedures then what document should I refer, I am am new for triggers and SP. Googling is random way I see. Would you refer any good books for this?
Corrected Trigger is as below:
SET TERM ^ ;
CREATE TRIGGER MYTRIGGER FOR TABLE_NAME ACTIVE
BEFORE UPDATE POSITION 0
as
begin
if (new.col3 is distinct from old.col3)
then new.col5 = current_timestamp;
end^
SET TERM ; ^
BEFORE UPDATE POSITION 0
as
begin
if (new.col3 is distinct from old.col3)
then new.col5 = current_timestamp;
end^
SET TERM ; ^
Thanking You And With Best Regards.
Vishal
On Wednesday, 9 August 2017 3:35 PM, "Paul Vinkenoog paul@... [firebird-support]" <firebird-support@yahoogroups.com> wrote:
Vishal Tiwari vishualsoft@... [firebird-support] schreef op
09-08-2017 11:58:
My fault! If forgot the trigger name. It should be:
create trigger MyTrigger before update on Table_Name ...
Instead of MyTrigger, you choose a more meaningful name of course.
Cheers,
Paul Vinkenoog
09-08-2017 11:58:
> I have put table name as Table_Name, which is actual table name.
>
> On Wednesday, 9 August 2017 3:27 PM, Vishal Tiwari
> <vishualsoft@...> wrote:
>
> Hi Paul,
>
> I am getting below error while executing the trigger you shared. May
> be because of new FB version? I am executing using FlamRobin tool.
>
> Please see error below:
>
> *** IBPP::SQLException ***
> Context: Statement::Prepare( create trigger before update on
> Table_Name
> as
> begin
> if (new.col3 is distinct from old.col3)
> then new.col5 = current_timestamp )
> Message: isc_dsql_prepare failed
>
> SQL Message : -104
> can't format message 13:896 -- message file
> C:\Windows\system32\firebird.msg not found
>
> Engine Code : 335544569
> Engine Message :
> Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 1, column 23
> update
My fault! If forgot the trigger name. It should be:
create trigger MyTrigger before update on Table_Name ...
Instead of MyTrigger, you choose a more meaningful name of course.
Cheers,
Paul Vinkenoog