473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Transform Cursor to Bulk

HI, I'm trying yo improve the performance of the following piece of
code.
Here I'm archiving Items that are done processing to Archive Tables.
I believe that if I use BULK INSERTS/SELECTS/UPDATES this process will
move much faster.

Can someone suggest me a way to do it?
Thanks

declare
cursor curflowdoc is select docid, state, other, rowid
from diego_parent
where state = 200;
show_value varchar2(40);
v_payee varchar2(40);
begin
for cur1 in curflowdoc loop
--Archive child items
insert into diego_child_arch
select * from diego_child
where docid = cur1.docid;

--Archive Parent items
insert into diego_parent_arch
select * from diego_parent
where rowid = cur1.rowid;

show_value := to_char(cur1.docid);
dbms_output.put_line('Deleting ' || show_value);

---More selects and updates here on other tables here based on
that DOCID
select payee into v_PAYEE
from payee_T
where other = cur1.other;

insert into temp(a,b,c) values(cur1.docid, cur1.state, v_payee);

--Delete Archived child items
delete from diego_child
where docid = cur1.docid;

--Delete Archived Parent items
delete from diego_parent
where rowid = cur1.rowid;
end loop;
end;
Jul 19 '05 #1
2 7025
dp*****@yahoo.com (Diego) wrote in message news:<5b**************************@posting.google. com>...
HI, I'm trying yo improve the performance of the following piece of
code.
Here I'm archiving Items that are done processing to Archive Tables.
I believe that if I use BULK INSERTS/SELECTS/UPDATES this process will
move much faster.

Can someone suggest me a way to do it?
Thanks

declare
cursor curflowdoc is select docid, state, other, rowid
from diego_parent
where state = 200;
show_value varchar2(40);
v_payee varchar2(40);
begin
for cur1 in curflowdoc loop
--Archive child items
insert into diego_child_arch
select * from diego_child
where docid = cur1.docid;

--Archive Parent items
insert into diego_parent_arch
select * from diego_parent
where rowid = cur1.rowid;

show_value := to_char(cur1.docid);
dbms_output.put_line('Deleting ' || show_value);

---More selects and updates here on other tables here based on
that DOCID
select payee into v_PAYEE
from payee_T
where other = cur1.other;

insert into temp(a,b,c) values(cur1.docid, cur1.state, v_payee);

--Delete Archived child items
delete from diego_child
where docid = cur1.docid;

--Delete Archived Parent items
delete from diego_parent
where rowid = cur1.rowid;
end loop;
end;

Sure
Just read the PL/SQL manual on BULK INSERT.
This newsgroup is a volunteer operation, you can't expect we are going
to develop your code.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2
I was not expectin that, so you are wrong.
I was expecting suggestions about the best way to do it.
Thanks "Senior DBA"

sy******@yahoo.com wrote in message news:<a1**************************@posting.google. com>...
dp*****@yahoo.com (Diego) wrote in message news:<5b**************************@posting.google. com>...
HI, I'm trying yo improve the performance of the following piece of
code.
Here I'm archiving Items that are done processing to Archive Tables.
I believe that if I use BULK INSERTS/SELECTS/UPDATES this process will
move much faster.

Can someone suggest me a way to do it?
Thanks

declare
cursor curflowdoc is select docid, state, other, rowid
from diego_parent
where state = 200;
show_value varchar2(40);
v_payee varchar2(40);
begin
for cur1 in curflowdoc loop
--Archive child items
insert into diego_child_arch
select * from diego_child
where docid = cur1.docid;

--Archive Parent items
insert into diego_parent_arch
select * from diego_parent
where rowid = cur1.rowid;

show_value := to_char(cur1.docid);
dbms_output.put_line('Deleting ' || show_value);

---More selects and updates here on other tables here based on
that DOCID
select payee into v_PAYEE
from payee_T
where other = cur1.other;

insert into temp(a,b,c) values(cur1.docid, cur1.state, v_payee);

--Delete Archived child items
delete from diego_child
where docid = cur1.docid;

--Delete Archived Parent items
delete from diego_parent
where rowid = cur1.rowid;
end loop;
end;

Sure
Just read the PL/SQL manual on BULK INSERT.
This newsgroup is a volunteer operation, you can't expect we are going
to develop your code.

Sybrand Bakker
Senior Oracle DBA

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jason | last post by:
What are the technical challenges in getting a local SMTP email server set up on a win3k system or alternatively on a win2k pro local work statation. We are on the verge of acquiring a new win3k...
3
by: robert | last post by:
Mr. Kyte's article doesn't use cursors, while Mr. Feuerstein's book examples do. my recollection of conventional wisdom is to avoid using cursors. is this difference merely a question of style,...
2
by: php newbie | last post by:
Hello, I am trying to load a simple tab-delimited data file to SQL Server. I created a format file to go with it, since the data file differs from the destination table in number of columns. ...
7
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the...
0
debasisdas
by: debasisdas | last post by:
RESTRICTIONS ON CURSOR VARIABLES ================================= Currently, cursor variables are subject to the following restrictions: Cannot declare cursor variables in a package spec. ...
0
by: tedlaraghu | last post by:
Hi everyone, When I am using dynamic sql with USING clause ,the results are not sorted in Ascending order. DECLARE TYPE emp_refcursor IS REF CURSOR; emp_rc ...
5
kaleeswaran
by: kaleeswaran | last post by:
hi! how to get a cursor values inside the java.i written procedure for getting 3 columns values like menuName,menuId,targetUrl it depends upon menuId so i am getting bulk values so i am using...
0
debasisdas
by: debasisdas | last post by:
We can fetch from a cursor into one or more collections: DECLARE TYPE NameList IS TABLE OF employees.last_name%TYPE; TYPE SalList IS TABLE OF employees.salary%TYPE; CURSOR c1 IS SELECT...
2
by: Diego | last post by:
HI, I'm trying yo improve the performance of the following piece of code. Here I'm archiving Items that are done processing to Archive Tables. I believe that if I use BULK INSERTS/SELECTS/UPDATES...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.