How to set id to auto-increment in plsql
First create a table.
Select New in the directory (tables): the one I created is SYS_TEST
Create sequence
Choose New in the directory sequences. The name I created is SYS_TEST_SEQ
Click Apply below.
Create trigger
Choose New in the directory Triggers. The name I created is SYS_TEST_TRI
After clicking Confirm, insert the select statement between begin
create or replace trigger SYS_TEST_TRI
before insert on SYS_TEST
for each row
begin
select SYS_TEST_SEQ.nextval into :new.ID from dual;
end;
After writing, right-click the window and click Execute.