Oracle AUTO_INCREMENT id

ALTER TABLE mytablename ADD (
CONSTRAINT pk_nomeindice PRIMARY KEY (ID));

CREATE SEQUENCE seq_nomeindice START WITH 1;

CREATE OR REPLACE TRIGGER tr_nomeindice
BEFORE INSERT ON mytablename
FOR EACH ROW

BEGIN
SELECT seq_nomeindice.NEXTVAL
INTO :new.id
FROM dual;
END;