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: TekDragon <TekDragon_at_hm.com>
Date: Tue, 18 Apr 2006 20:16:33 GMT
Message-ID: <BOb1g.16937$tN3.472@newssvr27.news.prodigy.net>


Thanks that did the trick.

I forgot about the max function. Why the +1? I tried it with out that and it works. My next question is what would happen if this application is used accross multiple computers at the same time? Would the correct customer_id by identified with the correct customer?

"onedbguru" <onedbguru_at_firstdbasource.com> wrote in message news:1145390327.156831.163740_at_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 - 15:16:33 CDT

Original text of this message

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