Oracle triggers and increment

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
create sequence eos_serviceitems_sequ

    increment by 1       A few -- every time increased

      start with 1       To start counting from several

      nomaxvalue         -- set the maximum value to the number of. Here is not set.

      nocycle            -- has been accumulated, not cycle

      cache             -- can be specified number sequence, a pre allocated in memory (the default value: 20)


Create trigger

create trigger eos_serviceites before

       insert on eos_serviceitems for each row


              select eos_serviceitems_sequ.nextval into:new.serviceid from dual;


- new data

insert into eos_serviceitems(serviceno, servicename, servicetypeno, unit, unitprice, companyid, deleteflag)

values('FW001', '001 service name ','FWLB001', 'a', 15.5, 'GSID001',1);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Yehudi at December 18, 2013 - 12:34 AM