0

I am pretty new to oracle. My current scenario is I need to add a NOT NULL column and update its value to 'EE'. This is done using below script.

ALTER TABLE CSA.CSA_CALL_AUDIT ADD CSA_CALL_TYPE varchar2(10);
update CSA.CSA_CALL_AUDIT set CSA_CALL_TYPE = 'EE';
ALTER table CSA.CSA_CALL_AUDIT modify CSA_CALL_TYPE not null;

My requirement is to update 1000 records only at a time. In total the table has 39000 records.

APC
  • 144,005
  • 19
  • 170
  • 281
AnishK
  • 11
  • 4

1 Answers1

0

IF EE is a default value this is the most performative way of making this change:

ALTER TABLE CSA.CSA_CALL_AUDIT ADD CSA_CALL_TYPE varchar2(10)
      default 'EE' not null;

Oracle does some magic in the data dictionary without touching the rows at all. (At least in 11g and later, not sure whether they introduced this enhancement earlier.)

But anyway, 39000 records is not a large number of records. If you need to issue an actual UPDATE just use a single statement. It won't take long.

APC
  • 144,005
  • 19
  • 170
  • 281