If id is null, use the value from sequence
SQL>
SQL> create table myTable(
2 id number primary key,
3 blob_content blob
4 )
5 /
Table created.
SQL>
SQL> create sequence myTable_seq
2 /
Sequence created.
SQL>
SQL> create or replace trigger biu_myTable
2 before insert or update on myTable
3 for each row
4 begin
5 if :new.id is null then
6 select myTable_seq.nextval into :new.id from dual;
7 end if;
8 end;
9 /
Trigger created.
SQL> drop table myTable;
Table dropped.
SQL> drop sequence myTable_seq;
Sequence dropped.
Related examples in the same category