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: User Sequence Numbers

Re: User Sequence Numbers

From: Hermann Angstl <hal_at_camline.com>
Date: Fri, 31 Jan 2003 11:59:31 +0100
Message-ID: <3E3A5713.72F51802@camline.com>


Matthias Rogel wrote:

> you don't want to update, so you don't need to lock a row

I dont' watn to update - but i want to have exclusive access to the *last* entry in the table (the one with the highest k value).

> lock table foo in exclusive mode;

This would be an overkill. Explanations follows ...

> Oracle noticed that disadvantage and invented sequences.

I' aware of sequences - but this is not exactely what i need. My real problem is a little bit more complicated. Let's assume we have the following two tables:

|--------------|
| parant_table |


| parent_name  | <- the key
| ...          |
|              |
|--------------|
       |
       | 1:n
       |

|--------------|
| child_table |
| parent_name  |  <- the key
| child_nr     |  <-
| ...          |
|              |
|--------------|


I want to create unique numbers in table child_table for each parent. The numbers have to unique only for each parent_name:

parent_name child_nr


joe                  1
joe                  2
joe                  3

john                 1
john                 2

ron                  1
Received on Fri Jan 31 2003 - 04:59:31 CST

Original text of this message

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