Updating using cursor oracle

You are not required to make changes to the records in order to use this statement.The record locks are released when the next commit or rollback statement is issued.create or replace PROCEDURE TABLE_UPDATE AS CURSOR REC_CUR IS SELECT ROWID FROM TEMP_TABLE where ROW_ID IS NULL AND NROW_ID IS NOT NULL; TYPE ROWID_T IS TABLE OF VARCHAR2(50); ROWID_TAB ROWID_T; BEGIN OPEN REC_CUR; LOOP FETCH REC_CUR BULK COLLECT INTO ROWID_TAB LIMIT 5000; EXIT WHEN ROWID_TAB. That said, your code selects and updates the same table. It access rows directly through OS layer that is highly I/O intensive process." Please help whether this update statement can create any performance related problem.From what I understand of the above, it looks like you can do: update temp_table set nrow_id = rowid; Though why you want to set a column to the rowid is beyond me! update (select t.value,s.new_value from t, s where t.value = s.value and s.fld_name = 'A') set t.value = s.new_value This update will fail if s.new_value is not unique.But i have a unuqie key on s.value s.fld_name this means for every t.value i will get exactly one s.new_value.

Let’s take a closer look at these five cursor FOR loop recommendations. This advice may come as something of a shock to you.Since my table is too huge and update will be on many rows(some cases upto millions) I face severe bad performance.Hence I am trying to use a WITH clause during update but I'm hitting error in it. From last few days I came across many situations where I need to update a table based on some analytical function output.Since, my table don't have any primary key I am having limitation on update using SQL and hence I left with the only alternatives of using PL/SQL.He says it’s the easiest way to fetch data, and Oracle Database automatically optimizes it in Oracle Database 10g and above. It’s not so great, however, when the advice is simplistic and results in suboptimal code.


Leave a Reply