SQL>
SQL>
SQL> create table myTable (id number);
Table created.
SQL>
SQL> create sequence wo_seq;
SQL>
SQL> create or replace trigger trg_id before insert
2 on myTable
3 for each row
4 when (new.id is null)
5 begin
6 select wo_seq.nextval into :new.id from dual;
7 end;
8 /
Trigger created.
SQL>
SQL> drop table myTable;
Table dropped.
SQL>
|