Subject problem with transaction and inserting detail record
Author arenpiotr
Hello,

I want have functionality: 1 user start editing record and lock this
record. Second user is going to editing record and have info -
recrd locked by 1 user. And this work fine,
but I have problems with inserting records into detail table (when
record master is locked, I locked record by "with lock" or simpli make
update on first field in table)

This is example:
when I lock master record in transaction record, I cant add detail
record to this master record in detail table

for example: I have this structure:
--table master
create table tabm
(
idm integer not null,
polem varchar(10) ,
constraint PK_TABM primary key (idm)
);
--table detail
create table tabd
(
idd integer not null,
idm integer ,
poled varchar(10) ,
constraint PK_TABD primary key (idd)
);

alter table tabd
add constraint FK_TABD_REF_7_TABM foreign key (idm)
references tabm (idm) ON DELETE CASCADE ON UPDATE CASCADE;


INSERT INTO TABM (IDM, POLEM) VALUES (1, 'aaa');
COMMIT WORK;
INSERT INTO TABD (IDD, IDM, POLED) VALUES (1, 1, 'aaa');
COMMIT WORK;

Now I have First connection and execute scrpit (without commit):

--I update master record
update tabm set polem = 'aaauuu' where idm =1;


In second connection I execute sript:

--I am going to insert detail record and in this line I have error
INSERT INTO TABD (IDD, IDM, POLED) VALUES (2, 1, 'bbb');
commit;

In second trasaction I have error


Is any posibility to solve this problem. Maybe some kind isloaction
level slolve this problem ???/
Or You have another solutions

Regards Piotr