I have a table which already contains some rows and does not have a primary key.
I want to add a primary key now, but for that I need to set unique values for the primary key field of the existing rows. How can this be done, using the newly added generator?
Primary key does not generate any values by itself. It is constraint. In your example you need do next:
Example: