5
p. Ej. Tengo una tabla:¿Cómo agregar un campo de autoincrement para una tabla existente y rellenarlo con números de serie para las filas?
create table test (testdata varchar2(255));
entonces necesito un campo de incremento automático:
alter table test add id numeric(10);
create sequence test_seq
start with 1
increment by 1
nomaxvalue;
create trigger test_trigger
before insert on test
for each row
begin
select test_seq.nextval into :new.id from dual;
end;
¿Qué debo hacer a continuación para poblar campos ya existentes con sus números de serie "id"?
¿Siempre es 'TABLE_NAME_seq.nextval'? – Xonatron