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

Home -> Community -> Usenet -> c.d.o.misc -> Re: New Id usign max(id)

Re: New Id usign max(id)

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Thu, 6 Oct 2005 17:46:57 -0400
Message-ID: <t-ednYhMTKHLBtjeRVn-sw@comcast.com>

"mike" <hillmw_at_charter.net> wrote in message news:1128634566.352837.5960_at_z14g2000cwz.googlegroups.com...
>I don't have a problem with sequence, its just that I'll need to start
> a new sequence for every NUM that happened to be created.
>
> That is not do-able is it? I think I'd just have to have 1 sequence
> and mytable would end up looking like:
>
> NUM ID
> 1 1
> 1 2
> 1 3
> 2 4
> 2 5
> 2 6
>
> Correct?
>

missed that it ws the 2nddary ID

ok, in the case of a 2ndary ID (line a LINE_NO) then just SELECT FOR UPDATE the 'parent' row (what every rows in whatever table the value if NUM references), then do your MAX(ID) and start your 'child' inserts

this will also serialize transactions, but only if multiple users are going after the same 'parent' or inserting new 'child' records for the same 'parent'

++ mcs Received on Thu Oct 06 2005 - 16:46:57 CDT

Original text of this message

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