Yes, I was considering that myself. I rather like having the trigger,
because it enforces the correct sequence for the correct table (I can
just see myself selecting from the wrong sequence and wondering why my
PK was violated).

-----Original Message-----
From: Deanna Schneider [mailto:[EMAIL PROTECTED] 
Sent: Monday, 6 June 2005 7:55 
To: CF-Talk
Subject: Re: Get New Record ID in mySQL

You can also switch the order of your queries in Oracle, so first you
Select myseq.nextval as newid from dual 

Then you
INSERT into mytable(myid)
values(newid)

On 6/6/05, James Holmes <[EMAIL PROTECTED]> wrote:
> If you don't mind supplying the DB with a key, that would work.
> 
> This convo has prompetd me to realise that I'm still using a 
> transaction with select max() in Oracle via the default transaction 
> behaviour (i.e not serializable) and there is a small chance, as 
> Jochem said, that this could give an erroneous result.
> 
> It seems that in Oracle the best thing to do, when getting a value 
> from a trigger that selects from a sequence, would be to use something

> like
> this:
> 
> declare
>   i number;
> begin
>   insert into sometable (something)
>   values (9) returning someid into i;
> 
> Any other ideas for Oracle?
> 
> -----Original Message-----
> From: Calvin Ward [mailto:[EMAIL PROTECTED]
> Sent: Monday, 6 June 2005 5:03
> To: CF-Talk
> Subject: RE: Get New Record ID in mySQL
> 
> How about using a UUID for the primary key and then you wouldn't have 
> to do the select?
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208658
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to