commit statement problem! [message #84779] |
Mon, 26 April 2004 02:04 |
sailaja
Messages: 11 Registered: October 1999
|
Junior Member |
|
|
hi, here is my problem...
i have got 3 blocks on my form... suppose.. masterblk,ch1blk,ch2blk of which there is mater detail relationship to masterblk-ch1blk and masterblk-ch2blk.
ch2blk is multi record block. after i have done with all necessary inputs ,i am using commit to commit changes ....checking some requied conditions i am using commit 3 times...once per each blk.
for one block i need sequenceno to be inserted into ch1table.so i am doing the following way.
declare
sqno numebr:=0';
begin
if ( some condiions )
commit ;(for master blk); ---- 1st commit;
end if;
if (some condtitions)
commit (for ch1blk); ----- 2nd commit;
end if;
for ch2 blk......i need to insert seqno for record in master record
go_block('ch2blk');
first_record;
loop
ch1blk.item1:=:masterblk.item1;
seqno:=seqno+1;
//and so on...few items which must be picked up from master table are asigned explicitely.and the rest are on the block itself so next i am using commit next line to store
ch1.seqno:=seqno;
commit; ----3rd commit;
exit when :system.last_record ='true';
next_record;
end loop;
when i am doing the above way.... i am not getting that seqno inserted into table but the records are inserted into tabel with out seqno
if i remove 1st and 2nd commit with 3rd commit....
what i understand abt commit statement is it commits what all on the blocks on form to respective tables.... irrespective of present block where cursor is.
even i tried using insert into statement explicitely and use commit after.... but i am getting that records inserted twice with seqno.
can any one please help me out ....
thanks in advance....
sailaja
|
|
|
|
Re: commit statement problem! [message #84814 is a reply to message #84779] |
Thu, 29 April 2004 10:20 |
ram kumar
Messages: 113 Registered: August 2002
|
Senior Member |
|
|
Hi Sailaja..
one way of doing is use databse triggers....but with this u cant see the seqno on form .unless u requery the form...
second way is to generate seqno and assign to field on form in child block in pre insert trigger that way u can see seqno on form with out requery...
Ram
|
|
|
Re: commit statement problem! [message #84857 is a reply to message #84814] |
Wed, 05 May 2004 21:51 |
sailaja
Messages: 11 Registered: October 1999
|
Junior Member |
|
|
thanku ram,my one more problem was with commit statemmetn or commiting changes in two blocks master and child
if (conditions)
---
---
commit; (master block)
end if;
if (conditions)
---
---
/* commit;(child table block)*/
end if;
in the piece of code,i am using commit in master block at that commititself.. even child tables data is also saved into the tables...i.e committing entire form...
i commented commit of second if loop of child block .. even then database changes for child table is done...i tried with 'insert into.... ' in each block... even then i got to use commit after insert in each if loop... that time child blocks data is also committed to tables...
how can i overcome committing of entire form...
let me also know clear differnce between forms_ddl('commit') and just plain commit??
thanks in advance..
|
|
|
Re: commit statement problem! [message #84862 is a reply to message #84857] |
Thu, 06 May 2004 01:58 |
A Ikramur Rahman
Messages: 81 Registered: May 2004
|
Member |
|
|
Hi Sailaja
Use ON-COMMIT or ON-INSERT Trigger. These type of triggers supercede the launching transaction. For example, the statements in an on-insert trigger replace the INSERT statement issued by the data block
|
|
|
Re: commit statement problem! [message #84866 is a reply to message #84857] |
Thu, 06 May 2004 05:26 |
ram kumar
Messages: 113 Registered: August 2002
|
Senior Member |
|
|
Hi Sailaja,
if u can send me ur fmb it will be nice..
u mentiond code but u dint mention in which tirgger the code is placed.
i dont want to just give answer with out understanding ur real problem...
if i am right ...
u r trying to control commits on each block based ons some if statement...
cant u do in on insert and on update triggers of each master and detail block say like for example
master block
on insert trigger
if .....
insert.............or Insert_record
end if;
on update trigger
if .....
update.............or update_record
end if;
like wise do same for...detail blocks..
commit ...or commit_from...commited all unsaved changed on the form..
i am sure i dint explain well..it was just a attempt..
Regards
Ram
Note:
best way is end ur form to my mail and mention problem either here or in mail....
|
|
|