Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: help with database

Re: help with database

From: onedbguru <onedbguru_at_firstdbasource.com>
Date: 18 Apr 2006 12:58:47 -0700
Message-ID: <1145390327.156831.163740@v46g2000cwv.googlegroups.com>


you are selecting ALL customer_ids into :new.customer_id...

not complete syntax
create sequence newcustseq.....

create or replace trigger wine_cust_trigger before insert on wines
for each ro
begin
select newcustseq.nextval into :new.customer_id from dual; end ;
/

OR

this very poor-man's sequence that is not very scalable due to locking etc..
create or replace trigger wine_cust_trigger before insert on wines
for each ro
begin
select max(customer_id)+1 into :new.customer_id from customer ; end ;
/
Received on Tue Apr 18 2006 - 14:58:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US