You actually have 2 issues, although your question only addresses 1 of them. You must not only 'fix the data' but also 'fix the system'. With the second (unaddressed) being the most important. There are 2 methods for this, lets call them
- the correct method
-- update existing data
update person1
set name = 'PERSON' || to_char(rownum,'FM999')
where id is null;
-- fix the system
alter table person modify name not null;
- the band-aid method
-- prepare for long term bandaid
create sequence unknown_person_seq;
-- update existing data
update person
set name = 'PERSON' || to_char(unknown_person_seq.nextval, 'FM99')
where name is null;
select * from person2;
-- adjust the system
alter table person modify name default 'Person' || to_char(unknown_person_seq.nextval, 'FM99');
The difference being the correct method keeps further data corruption out of the system. See demo here. It is far better to raise an exception for invalid data than it is to allow or generate bogus data. Consider your Person table holds customer information and you refer to them as PERSON4. How long will they remain your customer?
"person"(in double quotes).person(without quotes) will be a lot easier to work with. - William Robertson