Home » Developer & Programmer » Forms » concurrency (Dev. 10g )
concurrency [message #622181] |
Fri, 22 August 2014 05:11 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
oralover2006
Messages: 144 Registered: January 2010 Location: India
|
Senior Member |
|
|
sorry for my bad english...
Through user interface (which running through Application Server), various users are accessing and entering data.
when user press Submit button ( may be there is NO TIME DIFFERENCE between them ),
- first calling procedure Insert_1 for all the transactions step-by-step in a Form GRID (multiple records entry),
when finished,
- it is calling second procedure Insert_2.
I want to ask about concurrency in TABLE_DETAIL
is it sure a user's all transactions completed first and then another user's data will process by Oracle?
( as I asked multiple users are simultaneously accessing and pressing Submit button through user interface ).
or is it possible, that DB receive a record from user1 and another record from user3 and then from user1, then user2 ... so on.
create table SCOTT.table_summary (
client_id varchar2(10),
tran_id number(5),
tran_date date,
tran_time varchar2(6),
qty number(10)
)
/
alter table SCOTT.table_summary
add constraint pk_tbl_smry PRIMARY KEY (client_id, tran_id)
/
create table SCOTT.table_detail (
client_id varchar2(10),
tran_id number(5),
product_id varchar2(10),
qty number(10),
rate number(8,2)
)
/
alter table SCOTT.table_detail
add constraint pk_tbl_dtl PRIMARY KEY (client_id, tran_id)
/
create or replace procedure SCOTT.insert_1 (
vClient_id IN varchar2,
vTran_id IN number,
vProduct_id IN varchar2,
vQty IN number,
vRate IN number
)
is
xx number:=0;
begin
-- here some verifications needed before inserting
--
insert into table_detail (
client_id,
tran_id,
product_id,
qty,
rate
)
values (vClient_id,
vTran_id,
vProduct_id,
vQty,
vRate
);
end;
/
create or replace procedure SCOTT.insert_2 (vTran_id IN number)
is
xx number:=0;
begin
-- here some verifications needed before inserting
--
insert into table_summary (
client_id,
tran_id,
tran_date,
tran_time,
qty
)
Select Client_id, tran_id, to_date(sysdate,'DD-MON-RRRR'), to_char(sysdate,'hh24miss'),
SUM (qty)
From table_detail
Where tran_id = vTran_id
Group By Client_id, tran_id;
end;
/
-- Forms contians Data Block ( Multi Record GRID ) which is not a Database Data block
-- User can't enter Client_ID and Tran_ID ( Client_ID is Login ID and Tran_ID is generated with SEQUENCE )
Button : Submit
Trigger: WHEN-BUTTON-PRESSED
PROCEDURE insert_records IS
xx NUMBER := 0;
total_records NUMBER;
trn_id Table_Summary.Tran_ID%TYPE;
BEGIN
Go_Block('DETAILS');
Last_Record;
total_records := to_number(:System.Cursor_Record);
First_Record;
--
trn_id := :DETAILS.Tran_id;
--
FOR i IN 1..total_records
LOOP
SCOTT.insert_1 (
:DETAILS.Client_id,
:DETAILS.Tran_id,
:DETAILS.Product_id,
:DETAILS.Qty,
:DETAILS.Rate
);
Next_Record;
END LOOP;
--
SCOTT.insert_2 ( trn_id );
--
Commit;
call_alert_ok('process completed successfully!');
END;
please pardon me if I failed to ask about my problem clearly.
regards.
[Updated on: Fri, 22 August 2014 05:33] Report message to a moderator
|
|
|
Re: concurrency [message #622192 is a reply to message #622181] |
Fri, 22 August 2014 07:48 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
It'll do both users inserts at the same time unless you write code to prevent it - using dbms_lock for example.
|
|
|
Re: concurrency [message #622310 is a reply to message #622192] |
Mon, 25 August 2014 02:06 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
oralover2006
Messages: 144 Registered: January 2010 Location: India
|
Senior Member |
|
|
cookiemonster wrote on Fri, 22 August 2014 18:18It'll do both users inserts at the same time unless you write code to prevent it - using dbms_lock for example.
thanks very much for your reply cookiemonster
I had very basic knowledge of Forms and also SQL/PL-SQL, not used dbms packages but one OUTPUT to print data.
can you please help me to understand and write code to handle the situation?
I read here for dbms_lock but failed to implement...
Link for Oracle Documentation 11g for DBMS_LOCK
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_lock.htm
regards.
.
[Updated on: Mon, 25 August 2014 02:07] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Mon Sep 09 08:30:00 CDT 2024
|