Posts Tagged oracle

Oracle: add an autoID

Posted by on Wednesday, 7 March, 2012


create sequence PAGE_PROPERTIES_ID;


create or replace trigger PAGE_PROPERTIES_ID
before insert on PAGE_PROPERTIES
for each row
begin
if :new.id is null then
select PAGE_PROPERTIES_ID.nextval into :new.id from dual;
end if;
end;
/