Thanks Connor
sona sh, February 12, 2016 - 11:33 am UTC
Thanks for answering ,I will explain my requirement again.
I have to write a plsql procedure or script which update the update statement and set one of the column say indexnew=1,
the whole block of code should run for 4 times if the record is 2000.and i want to run it in n(4 in this case) run.
2000 record/500 = 4 count.
each time the inndexnew should be incremented by 1.
update
table set indexnew = 1
where column1 is not null
and indexnew is null
and rownum < 500
;
commit;
I have to manually increment the following:
set attachment = 2
so next run will be set attachment = 3
and the run after that will be set attachment = 4
what i meant is like a procedure/function which can increment the count value everything it get executed.
I am trying to batch up the records into batches of 500
I just want to launch a script that does this for me automatically - rather than me having to increment the batch number.
Hope the requirement is clear now.
Please reply and can you plz give me whole code for the same.
Thanks Connor
sona sh, February 12, 2016 - 11:33 am UTC
Thanks for answering ,I will explain my requirement again.
I have to write a plsql procedure or script which update the update statement and set one of the column say indexnew=1,
the whole block of code should run for 4 times if the record is 2000.and i want to run it in n(4 in this case) run.
2000 record/500 = 4 count.
each time the inndexnew should be incremented by 1.
update
table set indexnew = 1
where column1 is not null
and indexnew is null
and rownum < 500
;
commit;
I have to manually increment the following:
set attachment = 2
so next run will be set attachment = 3
and the run after that will be set attachment = 4
what i meant is like a procedure/function which can increment the count value everything it get executed.
I am trying to batch up the records into batches of 500
I just want to launch a script that does this for me automatically - rather than me having to increment the batch number.
Hope the requirement is clear now.
Please reply and can you plz give me whole code for the same.
February 13, 2016 - 5:07 am UTC
Something like this ?
declare
l_counter int := 1;
begin
--
-- if you always have to pick up where you left off then have this
-- (assuming this is a single user operation)
--
select max(counter)+1 into l_counter from T;
loop
update T
set indexnew = l_counter
where [your conditions]
and indexnew is null
and rownmum <= 500;
exit when sql%notfound;
l_counter := l_counter + 1;
end loop;
end;
Thanks Connor
sona sh, February 15, 2016 - 10:19 am UTC
THANKS FOR ANSWERING,IT WAS A GREAT HELP
Thanks Connor
sona sh, February 15, 2016 - 10:21 am UTC
HI CONNOR,
IT WILL BE REALLY GREAT IF YOU CAN GUIDE ME TO IMPROVE MY PLSQL CODING,
OR IF YOU CAN SHARE SOME LINK FROM WHERE I CAN LEARN IT SOON.
IT IS VERY MUCH REQUIRED IN MY PROJECT.
THANKS
CONNOR
February 15, 2016 - 10:31 am UTC
Thanks Chris
sona sh, February 15, 2016 - 10:43 am UTC
Thank a ton Chris for sharing the link.It will be a great help for me.
February 15, 2016 - 11:25 am UTC
Glad we could help