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

Home -> Community -> Usenet -> c.d.o.server -> Re: Autonumber

Re: Autonumber

From: Jerry Gitomer <jgitomer_at_p3.net>
Date: Thu, 09 Apr 1998 23:29:47 -0400
Message-ID: <352D922B.778F@p3.net>


Hi bubba,

In Oracle we use SEQUENCE to do this. Create a sequence (see the CREATE SEQUENCE command in the SQL reference manual) and then when you insert a new row in your table set it to the NEXTVAL of your sequence. If you want to use the same value more than once, for example if you are creating an invoice header table and an invoice line item table where you want the line items to include the invoice number assigned when you create the invoice header table, you use CURRVAL.

Regards

Jerry

bubba wrote:
>
> In MS Access there is an autonumber type which guarentees a unique primary
> key that is automatically generated.
>
> I have created a test table with two fields on an oracle database.
>
> testID ---primary key - unique
> TestData -- varchar2 (50) nulls allowed
>
> When I try and enter data into the Testdata field using ODBC via MS access
> linked tables, I get an error message that says that testID cannot be null.
>
> Why doesn't oracle create a unique number here?
>
> What am i doing wrong?
>
> brittonb_at_webt.com

--
Jerry Gitomer Since I know how to spell DBA I became one. jgitomer_at_p3.net Received on Thu Apr 09 1998 - 22:29:47 CDT

Original text of this message

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