ALTER TABLE HISTNEGOCIAPCOL ADD NRHISTNEGOCIAPCOL NUMBER
/

CREATE SEQUENCE SEQ_HISTNEGOCIAPCOL START WITH 1 INCREMENT BY 1
/

DECLARE
   V_COUNT NUMBER;
BEGIN
   V_COUNT := 0;
   FOR C_HIST IN (SELECT ROWID
                    FROM HISTNEGOCIAPCOL)
   LOOP
      UPDATE HISTNEGOCIAPCOL
         SET NRHISTNEGOCIAPCOL = SEQ_HISTNEGOCIAPCOL.NEXTVAL
      WHERE ROWID = C_HIST.ROWID;
      V_COUNT := V_COUNT +1;
      
      IF V_COUNT = 500 THEN
         COMMIT;
         V_COUNT := 0;
      END IF;
   END LOOP;
END;
/
COMMIT
/ 

ALTER TABLE HISTNEGOCIAPCOL DROP CONSTRAINT PK_HISTNEGOCIAPCOL
/

DROP INDEX PK_HISTNEGOCIAPCOL
/

ALTER TABLE HISTNEGOCIAPCOL ADD CONSTRAINT PK_HISTNEGOCIAPCOL PRIMARY KEY (NRHISTNEGOCIAPCOL)
/