Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: New Id usign max(id)
"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
![]() |
![]() |