/**************************************************************************************/
/* File:        demo40                                                                */
/* Project:     ATSQL2 : UPDATE                                                       */
/* Author:      Thomas Myrach, IWI Bern                                               */
/* Date:        24.10.1995                                                            */
/* Results:                                                                           */
/**************************************************************************************/

create table tpersnati (name char(10), nation char(2))
as valid and transaction;

set clock to timestamp '1975';

nonsequenced valid period '1960-forever'
insert into tpersnati values ('Hinz','D');
commit;

set clock to timestamp '1980';

nonsequenced valid period '1965-forever'
insert into tpersnati values ('Kunz','D');
commit;

set clock to timestamp '1991';

nonsequenced valid period '1991-forever'
update tpersnati set nation='CH' where name='Hinz';
commit;

set clock to timestamp '1995';

nonsequenced valid period '1994-forever'
delete from tpersnati where name='Kunz';
commit;

valid and transaction select * from tpersnati;

/* Kunz hat die Schweiz 1994 verlassen */

set clock to timestamp '1998';

nonsequenced valid period '1997-forever'
update tpersnati set nation='F' where name='Kunz';

nonsequenced valid period '1997-forever'
update tpersnati set (nation)=(select 'F' from dual) 
where name='Kunz';

/* Diese Operation sollte keine Auswirkung auf Kunz haben */

valid and transaction select * from tpersnati;

drop table tpersnati;


remove clock;

