Subject insert data in view based on union
Author jefmony2001
I try to use triggers to insert data in a view based on a union
clause, like the sample where the view is based on a join clause, but
it dosn't work for me.
Has anybody an idea or a working sample,
Thanks!

CREATE TABLE SITES_SERV
(
ID_SITE INTEGER NOT NULL,
CODE_STRUCT INTEGER NOT NULL,
NOM CHAR(30) CHARACTER SET WIN1252
);

CREATE TABLE SITES_TEMP_SERV
(
ID_SITE INTEGER NOT NULL,
CODE_STRUCT INTEGER NOT NULL,
NOM CHAR(30) CHARACTER SET WIN1252
);

CREATE VIEW SITES_COMPLET_SERV (
ID_SITE,
CODE_STRUCT,
NOM
) AS

select ID_SITE,CODE_STRUCT,NOM
from SITES_SERV
union
select ID_SITE,CODE_STRUCT,NOM
from SITES_TEMP_SERV
;

CREATE TRIGGER TRIG_INS FOR SITES_COMPLET_SERV
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
insert into SITES_TEMP_SERV
values (new.ID_SITE, new.CODE_STRUCT,new.NOM);
END