Charly Thomas
Charly Thomas

Reputation: 1

Trigger SQL Server for Firebird

I have a SQL Server trigger that I have tried to convert for Firebird but seems like I have some trouble with it.

Here is my SQL trigger:

CREATE TRIGGER [dbo].[IDSOFT_INTERV_UI]
   ON [MMAINT_SOCO_PROD].[dbo].[T_ZONES_LIBRES_UI]
   AFTER UPDATE
AS 
BEGIN
    IF UPDATE(STR_ZONE_LIBRE)
        BEGIN

        DECLARE @ui_id int,
                @num_interv int;
                
        SELECT @ui_id = d.LIEN_UI,
               @num_interv = e.NUM_INTERV
        FROM T_LIGNE_BT a
        inner join T_BT b on b.NUM_BT = a.CLE_BT
        inner join T_UI c on c.NUM_UI = b.CLE_UI
        inner join T_ZONES_LIBRES_UI d on d.LIEN_UI = c.NUM_UI
        inner join T_INTERV e on e.NOM_INTERV = d.STR_ZONE_LIBRE
        WHERE d.LIEN_UI in (select LIEN_UI from INSERTED) and d.INDICE_ZONE_LIBRE = 20;     
        
    Update a
    set a.cle_element = e.NUM_INTERV
    from t_ligne_bt a
    inner join T_BT b on b.NUM_BT = a.CLE_BT
    inner join T_UI c on NUM_UI = b.CLE_UI
    inner join T_ZONES_LIBRES_UI d on d.LIEN_UI = c.NUM_UI
    inner join T_INTERV e on e.NOM_INTERV = d.STR_ZONE_LIBRE
    where d.LIEN_UI = @ui_id
        and b.cle_ip is not null 
        and b.cle_ip <> 100000
        and a.type_ligne_bt like 'I'

      END
END

I'm really having problems to replicate the same for Firebird.

Can anyone help me please.

Upvotes: 0

Views: 150

Answers (0)

Related Questions