Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: PL/SQL question
Is it possible for all detail tables be updated without using a cursor. can u explain with example.
"Kennedy, Jim" <jim_kennedy_at_men To: <manoj.gurnani_at_polaris.co.in>, <oracle-l_at_freelists.org> tor.com> cc: Subject: RE: PL/SQL question 09/28/2005 07:02 PM
I don't see why you are using execute immediate. I think you could do it
all in one sql statement. To quote Mr. Kyte "Row by row is slow by slow".
I think you have over complicated it.
Jim
-----Original Message-----
From: oracle-l-bounce_at_freelists.org on behalf of
manoj.gurnani_at_polaris.co.in
Sent: Wed 9/28/2005 6:28 AM
To: oracle-l_at_freelists.org
Subject: Re: PL/SQL question
Below is the code.
the cursor has about 300000 recs.
The details tables have large volume of data and some have about 30 recs
for each ref_num in cursor.
This script has to be run .Can performance be increased.
I've tested this for 3000 recs in cursor and with lesser volume of data in
detail table.
time taken is 25 min.
Note :index is not present in all detail tables on column used in filter.
set timing on
set serverout on size 1000000
declare
l_commit_interval number := 5000; l_where_clause varchar2(2000); l_cnt number := 0; l_owner varchar2(25) := 'OWNER1'; l_index_cnt number := 4;
and a.table_name = b.table_name and b.column_name in ('REF_NUM','BILL_REF_NUM','FLDR_T2_ID','TXN_REF_NUM') and a.owner = l_owner and b.owner = l_owner;
begin
for curs1 in c1 loop
l_cnt := l_cnt + 1;
l_index_cnt := 4;
for curs2 in c2 loop
l_where_clause := ' where '||curs2.column_name || ' = :col1';
execute immediate 'update '||curs2.table_name||' set ctry_cd = ''KK'''||
l_where_clause
using curs1.ref_num;
txn_tab_cnt(l_index_cnt).tab_name := curs2.table_name; txn_tab_cnt(l_index_cnt).tab_aff_rows:= txn_tab_cnt(l_index_cnt).tab_aff_rows+sql%rowcount;l_index_cnt := l_index_cnt + 1;
rjamya <rjamya_at_gmail.com> To:manoj.gurnani_at_polaris.co.in
Sent by: cc:oracle-l_at_freelists.org
oracle-l-bounce_at_fr Subject: Re: PL/SQL question eelists.org 09/28/2005 06:42 PM Please respond to rjamya
You don't show us the code, you don't tell us what version,platform, you don't tell us how much time it takes and you don't tell us how much time ti should take.
Sorry, the crystal ball is broken, come back in 3 weeks.
ps: 1 lakh is one hundred thousand.
Raj
On 9/28/05, manoj.gurnani_at_polaris.co.in <manoj.gurnani_at_polaris.co.in > wrote:
Hi,
I've a cursor which retrieves about 3 lakh recs from a table.(master)
based on column value retrieved from cursor for each rec,there are other
tables (detail) to be updated.
The detail tables have large volumes of data.
the question is how can the performance be improved to achieve the desired
result.
This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--
http://www.freelists.org/webpage/oracle-l
This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Sep 28 2005 - 08:48:09 CDT
![]() |
![]() |