Multiple records in a non-DB block
I have about 10 records in a non-DB block (B_main).
I need to get all the records and insert them into a db table. How can I achieve this?
Forms10 text fields inside Retek are appearing with a default 'Yellow' color. I tried setting them to grey....but they are
still defaulting back to yellow when I run the form in the application. How can I change them to appear in grey?
Thanks,
Chiru
I have about 10 records in a non-DB block (B_main).
I need to get all the records and insert them into a db table. How can I achieve this?If you want to insert all the records into a DB-table, why do you use a non-DB-block for it? In that case you would have to do NO work, simply issue a COMMIT_FORM.
With the non-DB-block you have to loop over the block like:
FIRST_RECORD;
LOOP
INSERT INTO TAB (
COL1,
COLN
) VALUES (
:BLOCK.COL1,
:BLOCK.COLN
EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
NEXT_RECORD;
END LOOP;But again, why not use a database-block?
Similar Messages
-
HOW TO CREATE MULTIPLE RECORDS IN A NONE DATABASE BLOCK?
I have a Form where I have a none database block with unbound items. The block
has 10 records. In the when-new-block instance I run a query by which I would
like to fill up the block with data. The code fragment looks like the
following:
begin
declare
tmp_curr_rec_id number;
begin
-- a hibak kiolvasasa
for c_hibak in ( select h.*, h.rowid
from hibak h
where 1=1 -- WF - Ide kerul a szurofeltetel
order by bejelentes_datum asc
) loop
-- bemasoljuk az adatokat az unbound item-ekbe
:mc_adat.ub_azonosito := c_hibak.azonosito;
:mc_adat.ub_verzio_letrehozas_datum :=
c_hibak.verzio_letrehozas_datum;
:mc_adat.ub_bejelento := c_hibak.bejelento;
:mc_adat.ub_bejelentes_datum := c_hibak.bejelentes_datum;
:mc_adat.ub_wf_verzio_csomopont :=
c_hibak.wf_verzio_csomopont;
:mc_adat.ub_wf_utolso_esemeny_szoveg :=
c_hibak.wf_utolso_esemeny_szoveg;
:mc_adat.ub_hiba_leiras := c_hibak.hiba_leiras;
:mc_adat.ub_hiba_hely := c_hibak.hiba_hely;
:mc_adat.ub_rekord_jelleg := 'H';
:mc_adat.ub_rowid := c_hibak.rowid;
-- beallitjuk a rekordot-ot olyanra, mintha semmi nem valtozott
volna
-- nem szeretnenk a form bezaraskor mindenfele figyelmezteteseket
-- olvasni a kepernyon
tmp_curr_rec_id := get_block_property( :system.current_block,
current_record );
set_record_property( tmp_curr_rec_id, :system.current_block,
status, new_status );
create_record;
end loop;
end;
end;
The block's update allowed, insert allowed, delete allowed property is set to
true.
The result of the code above is that only the last record fetched shows up in
the block. The problem is - as I found out - is that aech record is fetched,
the values are copied to the block items, but the create_record built-in
command would not move the cursor to the next row.
Can some one please help me with this?
TIA,
Tamas SzecsyThe problem was with the following code segment:
tmp_curr_rec_id := get_block_property( :system.current_block, current_record );
set_record_property( tmp_curr_rec_id, :system.current_block, status, new_status );
After omitting these two lines, the code worked properly.
Thansk for all whoe replied.
Regards,
Tamas -
Can we create multiple records before navigation to that block
Can we create multiple records and assign values in Forms, before navigation to that block (in a trigger ), and populate ?
Hello,
No you cannot. You need to be inside the block in order to use the Create_Record built-in.
Francois -
Hi,
i want to sort a multiple record block by pressing a key on a non updatable field in the block.
Example:
i have a list of adresses in the block. Now i want to jump to all Adresses which starts with B.
Does anybody know a solution ?
Thanks in advance. MMNo problem:
When your records are ordered by the name (using block's order-by-clause),
use a procedure like the following:
procedure find_name(p_letter in varchar2) is
begin
go_block('BLOCK');
loop
exit when :system.last_record = 'TRUE' or :block.name >= p_letter;
next_record;
end loop;
end; -
Retrive Multiple Records Into A database Block
hi, all
i would like to know if there is any document or references wich illustrait the way of retriving Multi records from a procedure built on database side into a database block using form 6i ??
My Problem is : i create a procedure in the database which retrive a multiple records and the variable from procedure (out) are the same value from Form side (in). but it always fetch the whole records at the same record position in the block as the cursor raised on . i found a way explian how to mintain a set or record using a record type and create a table of that record type , but still don't' know how deal calling the procedure from the form side .
Any advice of this issue will be greatfull and if sample of code provided will be better
Thanks in Advance
Regards
OmarYou can try something like this:
PROCEDURE POPULATE_BLOCK IS
cursor c1 is
SELECT <your column names>
FROM <your table name>
where <your where condition>
BEGIN
open c1;
go_block('<your block name');
first_record;
loop
fetch c1 into
:<your block name>.<your column name 1>,
:<your block name>.<your column name 2>,
etc,etc
exit when c1%NOTFOUND;
next_record;
end loop;
close c1;
first_record;
END;
so your code might actually look something like this:
PROCEDURE POPULATE_BLOCK IS
cursor c1 is
SELECT distinct
a.pog_dept
,a.pog_number
,a.pog_level
,a.pog_id
,a.start_date
,a.transmit_date
,a.deactivate_date
,b.pog_description
FROM pog_stores_msi a, pog_master_msi b
where a.pog_dept = :b_main.bi_dept
and a.pog_number = :b_main.bi_pog_number
and a.pog_level = :b_main.bi_pog_level
AND A.POG_ID = :B_MAIN.I_POG_ID
and a.pog_dept = b.pog_dept
and a.pog_number = b.pog_number
and a.pog_id = b.pog_id;
BEGIN
open c1;
go_block('b_main');
first_record;
loop
fetch c1 into
:b_main.bi_dept
,:b_main.bi_pog_number
,:b_main.bi_pog_level
,:b_main.i_pog_id
,:b_main.i_start_date
,:b_main.i_transmit_date
,:b_main.i_deactivate_date
,:b_main.i_pog_desc;
exit when c1%NOTFOUND;
next_record;
end loop;
close c1;
END;
Hope this helps,
NumbNutz -
How to display records into a non table base block..
Hi,
Can anybody help me how to display records into a non table base block....
Find below is my coding but it only display the last record in the first line
in the block.
PROCEDURE CREATE_CARTON_QUESTION IS
CURSOR car_c IS
select /*+ rule */ question_id, question_description
from WHOP.QADB_QUESTIONS
where question_category = 'Carton'
and question_active_flag = 'Y';
v_found VARCHAR2(10);
v_status boolean;
v_error varchar2(150);
v_count number;
car_r car_c%rowtype;
begin
begin
select count(*) into v_count
from WHOP.QADB_QUESTIONS
where question_category = 'Carton'
and question_active_flag = 'Y';
exception
when no_data_found then
v_count := 0;
end;
if v_count > 0 then
for car_r in car_c loop
---populating carton questions
:la_carton.carton_question_id := car_r.question_id;
:la_carton.carton_question_answer := 'N';
:la_carton.carton_error_details := null;
:la_carton.attribute2 := car_r.question_description;
end loop;
end if;
end;
Thanks in advance.
Regards,
JunHi SNatapov,
Thanks for you reply but still I get this error...
FRM-40737 Illegal restricted procedure GO_BLOCK in WHEN-VALIDATE-ITEM trigger.
Please note that I call that program unit in the last field of my control block inside when-validate-item trigger the questions should be display in la_carton block which is my non-base table block.
Find below is the code....
begin
go_block('la_carton');
first_record;
for car_r in car_c loop
---populating carton questions
:la_carton.carton_question_id := car_r.question_id;
:la_carton.carton_question_answer := 'N';
:la_carton.carton_error_details := null;
:la_carton.attribute2 := car_r.question_description;
next_record;
end loop;
end;
Hoping you can help me this problem...
Thanks in advance.
Regards,
Jun -
Problem in UPDATE statement In Multiple Record Block
Hi Friends,
I have problem in update Statement for updating the record in multiple record data Block.
I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
I am inserting the fields like category,and post_no for partiular job in single data block
Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
then its updating all the record.
my code is Bellow,
IF v_count 0 THEN
LOOP
IF :SYSTEM.last_record 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
next_record;
ELSIF :SYSTEM.last_record = 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
:POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
EXIT;
END IF;
END LOOP;
SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
v_button_no := SHOW_ALERT('user_alert');
FORMS_DDL('COMMIT');
CLEAR_FORM(no_validate);
Please Guide me
Thanks in advenceAs you do a loop over all the records in the block, of course every record is updated.
Also, what you do is not the way is intended to be used. In general, you base a block on a table,then there is no need at all for writing INSERT's or UPDATE's. Forms also know's then, which records to be updated and which not. -
Problem In Update Statement In Multiple Record Data Block
Hi Friends,
I have problem in update Statement for updating the record in multiple record data Block.
I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
I am inserting the fields like category,and post_no for partiular job in single data block
Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
then its updating all the record.
my code is Bellow,
IF v_count <> 0 THEN
LOOP
IF :SYSTEM.last_record <> 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
next_record;
ELSIF :SYSTEM.last_record = 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
:POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
EXIT;
END IF;
END LOOP;
SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
v_button_no := SHOW_ALERT('user_alert');
FORMS_DDL('COMMIT');
CLEAR_FORM(no_validate);
Please Guide me
Thanks in advenceUPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;These update statements are without where clause, so it will update all records.
If it is specific to oracle forms then u may get better help at Forms section. -
Inserting multiple records in a data block
Hi, how do i insert multiple rows from a record group into a data block. Thanks
You do it manually. Copy the values and move to the next record in the record group and in the block.
You might like the concept of basing a block on a stored procedure better. Check out the stored procedure based block sample that comes with the Oracle Forms demos. -
Mouse hand over a block of multiple records help
Hello ,
i have add a bean i my form so that i could change the cursor to a hand when the mouse is over an item.
the problem that i have is that the block is a multiple record block i am showing 5 records.
so the mouse change only in the first record and not in the other records
has any one try to do the same and came with a solution?
or does anyone know how could i solve this problem?
thanks
anaHello Jan
i have this class
import java.awt.Graphics;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Font;
import oracle.forms.ui.VTextField;
import oracle.forms.properties.ID;
import oracle.forms.handler.IHandler;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Cursor;
public class Hotlink
extends VTextField
private Cursor stdCursor;
private Font stdFont;
private int stdStyle;
private Color stdForeColor;
private Color stdBackColor;
public Hotlink()
super();
public void init(IHandler h)
super.init(h);
stdCursor = this.getCursor();
this.addMouseListener(new MouseAdapter()
public void mouseEntered(MouseEvent me)
if(getTextLength() > 0)
((VTextField)me.getSource()).setForeground(Color.red);
((VTextField)me.getSource()).setBackground(Color.lightGray);
setFont(stdFont.deriveFont(Font.BOLD));
setCursor(new Cursor(Cursor.HAND_CURSOR));
public void mouseExited(MouseEvent me)
if(getTextLength() > 0)
((VTextField)me.getSource()).setForeground(stdForeColor);
((VTextField)me.getSource()).setBackground(stdBackColor);
setFont(stdFont);
setCursor(stdCursor);
public void paint(Graphics g)
super.paint(g);
if (this.getTextLength() > 0)
FontMetrics metrics = getFontMetrics(getFont());
int strWidth = metrics.stringWidth(getText());
int yoffset = (int)(metrics.getHeight() * 0.95);
g.drawLine(0, yoffset, strWidth, yoffset);
public boolean setProperty(ID pid, Object value)
if(pid.getName().equals("FOREGROUND")) this.stdForeColor = (Color)value;
else if(pid.getName().equals("BACKGROUND")) this.stdBackColor = (Color)value;
else if(pid.getName().equals("FONT")) this.stdFont = (Font)value;
return super.setProperty(pid, value);
and i had make a jar with it inside the text item i have put the reference to this class the thing is that it work with the 1º record also -
hi every one
i've developed a form containing a multiple record block. i need that some functions to be done before i commit it.
1. its primary key should b auto generated, usually i handle it by selecting max value(primary key field) from data base and adding one but in this case it wont work bcoz it wont go to database before i commit it. so it wont auto generate it.
2. second problem is that there are some fields that must b filled but it should prompt the user to enter required fields when he press commit button.
thanks in anticipation
kabirHave you considered creating a sequence object for the primary key. If the datatype of the primary key is NUMBER then a sequence will auto generate the next value if you placed (:your_sequence.next_val) into the dafault value property of the text item.
The second problem can be overcome by writing a When-Validate-Item trigger whereby the user will be prompted to the item that contained the required field that was not entered. You should however note that if a coulmn in your table is of the NOT NULL type then the form default behavior is to prompt user to enter the field. -
How to Save Multiple Records In Data Block
Hi All,
I Have Two Blocks --> Control Block,Database Block
Please Any Idea How to Save Multiple Records In Data Block when User changed Data in Control Block.
Thanks For Your Help
SaNow i have to use each record of control block(ctl_blk) as where condition in data base block(dat_blk)and display 10 records from database table.>
Do you want this coordination to be automatic/synchronized or only when the user clicks a button or something else to signal the coordination? Your answer here will dicate which trigger to put your code in.
As to the coordination part, as the user selects a record in the Control Block (CB), you will need to take the Key information and modify the Data Block's (DB) "DEFAULT_WHER E" block property. The logical place to put this code is the CB When-New-Record-Instance (WNRI) trigger. You code will look something like the following:
/* Sample WNRI trigger */
/* This sample assumes you do not have a default value in the BLOCK WHER E property */
DECLARE
v_tmp_dw VARCHAR2(250);
BEGIN
v_tmp_dw := ' DB_Key_Column1 = '||:CONTROL.Key_Column1||' AND DB_Key_Column2 = '||:CONTROL.Key_Column_2;
Set_Block_Property('DATA_BLOCK', DEFAULT_WHER E, v_tmp_df);
/* If you want auto coordination to occur, do the following */
Go_Block('DATA_BLOCK');
Execute_Query;
/* Now, return to the Control Block */
Go_Block('CONTROL_BLOCK');
END;
The Control block items are assigned with values in Form level (Key_exeqry).If your CD is populated from a single table, it would be better to create a Master - Detail relationship (as Abdetu) describes.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Multi-Record (NON-DB) block - duplicate records
I have a non-db block called 'EDITOR_INFO' that captures all the editor's information. The block has the following fields in it: editor_name,editor_type,address_lines1 thru4, city, state, zip, taxid_ssn_type,taxid_ssn.
I need to check to make sure that the user is not entering the duplicate editors. How can I adapt the infamous Kevin Clarke's solution to this (if at all)? What would be my datablock, control block etc?
Can any one pls. provide any guidance.
Thanks,
Chiru
Edited by: Megastar_Chiru on Nov 8, 2010 3:55 PM
Edited by: Megastar_Chiru on Nov 8, 2010 3:56 PMChiru, if all you need is to add/query records in a block, you should consider making a data-block instead of control-block. And use POST to post the data into table which will let you check against the table if a record exists or not.
But if you want to have it done using a control-block then follow below sample steps.
In WHEN-VALIDATE-RECORD of your control block, you can check if entered record is already in the table or not.
If it exists, then raise error message and stop until user corrects the data... if it does not exist, then INSERT into the table.
For this scenario, I created a small table with two columns.
CREATE TABLE TABLE_A (Col1 NUMBER, Col2 VARCHAR2(30));Now I created a form with a control block (BLOCK2). It has 10 records with vertical layout and two control-items on it (TEXT_ITEM4 and TEXT_ITEM5). And below is code used on WHEN-VALIDATE-RECORD.
-- WHEN-VALIDATE-RECORD
DECLARE
temp VARCHAR2(1);
CURSOR c_check_existance IS
SELECT 'X'
FROM table_a
WHERE col1 = :BLOCK2.text_item4;
BEGIN
:GLOBAL.Valid_Records := 'N';
IF :block2.text_item4 IS NOT NULL THEN
OPEN c_check_existance;
FETCH c_check_existance INTO temp;
IF c_check_existance%FOUND THEN
CLOSE c_check_existance;
:GLOBAL.Valid_Records := 'N';
MESSAGE('Record already exists in table');
RAISE FORM_TRIGGER_FAILURE;
ELSE
INSERT INTO table_a (col1, col2)
VALUES (:block2.text_item4, :block2.text_item5);
:GLOBAL.Valid_Records := 'Y';
END IF;
CLOSE c_check_existance;
END IF;
END;Remember, when making a control block like a data block, you have to code everything yourself. -
Lock records in non-db blocks....
Hi,
I make a test:
Run the same form twice - as two users would do - and try to update the same record almost simultaneously .. then a row lock is established - as expected.
I try another test:
Run the same form twice - as two users would do - and try to update the same record almost simultaneously , but the block is non db (control block). The update is done via a button.
I have written the following simple code:
DECLARE
EMPNO_VAR EMP.EMPNO%TYPE;
BEGIN
SELECT EMPNO INTO EMPNO_VAR FROM EMP
WHERE EMPNO=:EMP.EMPNO FOR UPDATE;
UPDATE EMP SET ENAME=:EMP.ENAME , JOB=:EMP.JOB ,
HIREDATE=:EMP.HIREDATE , SAL=:EMP.SAL
WHERE EMPNO=EMPNO_VAR;
COMMIT;
END;The result of the following is what Tom Kyte names "lost updates".... The update of the second user overwrite the update done by the first user ....
No lock row is established....
I have also tried:
DECLARE
EMPNO_VAR EMP.EMPNO%TYPE;
BEGIN
LOCK_RECORD;
UPDATE EMP SET ENAME=:EMP.ENAME , JOB=:EMP.JOB ,
HIREDATE=:EMP.HIREDATE , SAL=:EMP.SAL
WHERE EMPNO=EMPNO_VAR;
COMMIT;
END; But , no update is done ....
How can i lock the record in a block which is non-db (control block)...???
Note: I use Oracle db10g v.2 and DevSuite Form 10g
Thanks...
SimSim, you are missing a whole second part of this scenario. You initially retrieve the row's data in the WNFI trigger.
If you want to prevent the "Lost Updates" problem, you need to do what Forms default (automatic) processing does before it allows the second user to update a field. When the user makes the very first keystroke to make the first change in a base-table row, Forms does a select * for update nowait. THEN, it compares all the data fetched in this SECOND fetch with the database values stored for the row in the FIRST fetch. If they do not compare exactly, then some other user has updated the row and committed. In that case, Forms displays the message:
FRM-40654: Record has been updated by another user. Re-query to see change.
So, you need to do the same thing in your form, but you will need to do it manually.
When you initially fetch the data in the WNFI trigger, you need to store a copy of the values retrieved someplace where they will not be changed by the user. Then when your button is pressed to update the record, you need to select all the columns your form updates in the select... for update nowait.
At this point, you check for a locked row by checking for ORA-00054. If not locked, you then need to compare all the stored values against the new values fetched. If they compare equal (and here, be sure to treat null = null as true), you can continue. If they do not compare equal, then you need to prevent the update, and issue a message similar to the FRM-40654.
If the row is not locked and they compare equal, then you can go ahead and update the row. And be sure to update the values stored for a possible next comparison.
Whether or not you commit after the update is up to you. If you commit, it frees up the lock so another user can make the change. If this is the only change the form can make, then a commit is ok. But if this is only part of the changes a user can make, then I would not commit, and require the user to click a save button at some point, which would then commit all the changes.
Good luck! -
RM-30410: Warning: Single Record property ignored for non-control block
Hi gurus,
I have one block, as oracle default behavious is that when any user enters record and during that if he/she hits down arrow key then it gets to next new record, i want to prevent this behaviour.
In other words i want that user should not enter second record and if he or she needs to enter second record after saving first then user can only do if he navigate to the form second time.
In property pallete i put yes to single record but when i compile the form it gives me following warning
FRM-30410: Warning: Single Record property ignored for non-control block Employees
Created form file C:\my_forms\employees.fmxPlease seeks help that how can i sort it out.
Thank you
Hinaif he/she hits down arrow key then it gets to next new record, i want to prevent this behaviour. Change the block's key-down and/or key-nxtrec trigger to
begin
null;
end;(or give the user a message "Key not allowed here").
Maybe you are looking for
-
Problem whle starting the SOA server.
Hi, I have Installed Oracle SOA suite in a server. I have created a domain and with in that domain, there is Admin server, Soa server and BAM server. They were working fine. But when I tried to re-start them recently , the Admin server was showing th
-
Dear sir, iam having cisco 2821 router and VIC2-2E/M cord ,so plz give me some examples of configuration. Thanks&Regards srini
-
Slow mac and system break down
hi there My MacBookPro (2010) started to run slowly. The recent couple of weeks it started to break down too. Last time, just a minute ago. Can anyone make anything out of this crash report, cause I really cannot read programming at all. Any help, re
-
"You don't have permission to use the application -" pop up in managed account
Hi All, I have Net Nanny installed in my mac. When my child login to his managed account the following messages pops up: It does not matter which of the three choices I click, it keeps popping up. In the Safari parental control I have the Net Nanny
-
Looking for the right List...
Hi there! I want to use a List class to hold a potentially large number of elements. I don't care about randomly accessing elements; only Iterators will be used to iterate through the List. What I mostly care about is storage overhead and garbage col