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: Autonumber facility? Beginner question...

Re: Autonumber facility? Beginner question...

From: SKurosky <skurosky_at_aol.com>
Date: 24 Feb 2000 18:34:34 GMT
Message-ID: <20000224133434.14763.00001588@ng-fh1.aol.com>


>Bryan Wrote:

>I am totally new to trying to do the DBA side of things, but since the
>person who did that is no longer with us, I am doing it at least on a
>temporary basis.
>
>Can someone please show me how to set this up properly? As an example:
>
>CREATE TABLE test (
>ID number PRIMARY KEY,
>name varchar2(25),
>ID2 rowid
>);
>
>Then what? Here is a sample that I found somewhere, but can't get it to
>work.........
>
>CREATE SEQUENCE test.id increment by 1 start with 1;
>
>Also, what is the ROWID datatype? Should I be using that instead?
>
>=========================
>
>Lastly, I also found a piece of code that looks like:
>
>ALTER TABLE test ADD CONSTRAINT PCR_P_ROWID_UK UNIQUE(ID2);
>
>What does that do?
>
>=========================
>
>Like I said, this is not my normal job function, so please be clear, and
>give samples if possible. THANKS!!!!!!!
>
>Bryan
>bryan_at_latent.com
>
>
>Hi Bryan

 The ROWID is a unique identifier for each row that is generated by Oracle.

Your sequence problem is the "."
CREATE SEQUENCE test_id_seq
INCREMENT BY 1
START WITH 1
..... Other parameter, etc.

This will generate a unique number for each row of the (I assume) ID column in the TEST table. Somewhere should be insert statements that utilize this sequence..

No, don't use ROWID

The ALTER TABLE statement seems to be generating a unique index on the ID2 column of the TEST table, which does not make sense to me, if you are trying to emulate the ROWID, which is already unique??
>
>>HtH

Sandy

>> >
>> >
>>
>>
>>
>
>
>
>
>
>
>
>
Received on Thu Feb 24 2000 - 12:34:34 CST

Original text of this message

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