OracleArea51

Sponsored By Chola Global Services LLC

Oracle Forms: Saving only Selected Row in database

E-mail
(1 vote, average 4.00 out of 5)

One of my freind was having a small requirement:
1. Select one row at a time(only one row in Database block)
2. Only selected row should be saved in database, even other non-selected rows has been changed by the user.

For this requirement first thing is to add one checkbox and write one checkbox changed trigger to allow the user to select only one

row, following piece of code will do this:

declare
l_current_record number;
l_last_record number;
begin
l_current_record := :system.trigger_record;
last_record;
l_last_record := :system.cursor_record;
first_record;
for i in 1 .. l_last_record loop
if :system.cursor_record !=  l_current_record then
:item4 := 'N';
end if;
next_record;
end loop;
go_record(l_current_record);
end; 

where item4 is the name of check box, it will be having value "Y", when it is checked and "N" otherwise.

now change the status of Record to "QUERY", if row is not selected and it has been changed by the user.

when-validate-record at block level

IF(:Item4 = 'N')THEN
Set_Record_Property( :System.cursor_record, 'EMP', STATUS, QUERY_STATUS);
END IF; 

Reetesh
Points: 2031
Contact Author | Website :
 
Attachments:
Download this file (MODULE12.zip)Saving selected row in DB[ ]10 Kb28 Downloads

Related Posts:

relatedArticles
Trackback(0)
Comments (2)add comment

Binuraj said:

0
Nice one
Hi Reetesh,

Nice article...

I suppose line 10 should be

if :system.cursor_record != l_current_record then
 
July 27, 2009
Votes: +0

contactriteshsharma said:

0
...
Hi Binuraj,

Thanks a lot for Identifying the error, I have corrected it.

Regards,
Reetesh Sharma
 
July 27, 2009
Votes: +0

Write comment

busy