Subject | Re: [firebird-support] multirow consideration in FB |
---|---|
Author | Thomas Steinmaurer |
Post date | 2008-07-22T05:36:15Z |
Hello,
row-level triggers that means, the trigger fires for each deleted or
inserted or updated record.
So what you need is the first UPDATE statement in the @@ROWCOUNT = 1
condition. You don't need the second one. Although, you need a bit more
Firebird syntax in your trigger code. ;-)
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
> Hello, i would like to ask is it a multirow consideraton runs too at FB ?Unlike MSSQL, which has statement-level triggers, Firebird only has
> if it's run then how to create a trigger in FB from this quote of my mssql trig:
>
>
> CREATE TRIGGER intrig
> ON sales
> FOR INSERT AS
> IF @@ROWCOUNT = 1
> BEGIN
> UPDATE titles
> SET ytd_sales = ytd_sales + qty
> FROM inserted
> WHERE titles.title_id = inserted.title_id
> END
> ELSE
> BEGIN
> UPDATE titles
> SET ytd_sales = ytd_sales +
> (SELECT SUM(qty)
> FROM inserted
> WHERE titles.title_id = inserted.title_id)
> WHERE titles.title_id IN
> (SELECT title_id FROM inserted)
> END
row-level triggers that means, the trigger fires for each deleted or
inserted or updated record.
So what you need is the first UPDATE statement in the @@ROWCOUNT = 1
condition. You don't need the second one. Although, you need a bit more
Firebird syntax in your trigger code. ;-)
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com