If id is null, use the value from sequence
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.
Note:-Please comment and reply me.
It contain detail about all language and oracle. Checkout stackoverflow profile :- http://stackoverflow.com/users/995197/sushant
Friday, August 6, 2010
If id is null, use the value from sequence
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment