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 -> Help sequence problem!

Help sequence problem!

From: Ruiping Gao <ruiping_at_dpiwe.tas.gov.au>
Date: Thu, 13 May 1999 12:45:44 +1100
Message-ID: <373A2EC8.60CA7C6B@dpiwe.tas.gov.au>


Hi,
I have a problem about creating sequence.My purpose is to create a sequence which start from number 1 and increase by 1 every time. When I insert record into a table this sequence will insert my unique number into primary key fields.
For example, I have a table called table1 which have two fields, siteid,sitename. Whenever people insert sitename, my sequence can put continuence number like 1,2,3,4,5... etc. into siteid fields. My SQL syntax for create sequence as following:

create sequence uni_number increment by 1 order;

Then I will use insert into table1(siteid,sitename) values(uni_number.nextval,'survey1')

But after several times insert records I've got siteid number like this:

siteid            sitename
1                     survey1
2                     survey2
20                  sryvey3
21                   survey4
23                   survey5
30                   survey6

...
The result is not what I wanted, I don't know what the problem is, if anyone out there can give me a help I will be very grateful.

--
Ruiping

e_mail:ruiping_at_dpiwe.tas.gvo.au Received on Wed May 12 1999 - 20:45:44 CDT

Original text of this message

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