- Create My_Test Table
create table My_Test (
id number,
my_test data varchar2(255)
);
- secondly you can create a sequence for that table - a sequence is a specific oracle command that handles increments. -
create sequence test_seq
start with 1
increment by 1
nomaxvalue;
- an finally you can instanciate a trigger for that table forcing auto allocation of the designated column before the insert is performed :
create trigger test_trigger
before insert on My_Test
for each row
begin
select test_seq.nextval into :new.id from dual;
end;
No comments:
Post a Comment