In PLSQL, how do you iteratively update a field of a very large table?

I have a PLSQL table with 30 million rows and I want to update a field for all rows.

I tried a loop (batching up the update into 100000 row intervals) but I can't use

update tableA set columnA=1 where rownum between lower and upper

where the loop moves through new upper and lower values until the rowcount is exhausted.

Upvotes: 1

Views: 234

Answers (1)

Justin Cave
Justin Cave

Reputation: 231651

Why do you want to do the update iteratively? Why don't you want to do a simple UPDATE

UPDATE tableA
   SET columnA = 1

That't the most efficient way to update a large number of rows. It also generates the least amount of REDO and UNDO.

Upvotes: 3

Related Questions