473,320 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Oracle 10g Sequence Help please?

Hi

I've created a sequence on a table using oracle 10g express edition by using the following code:

create sequence referee_seq START WITH 1 INCREMENT BY 1

I then add a row to my table by using the following code:

insert into referee values(referee_seq.NEXTVAL,'','','','','','','','' ,'','')

For some reason its skipping values so my primary keys are goin up in 2's like 2, 4, 6, 8 etc etc even though my increment is set to 1.

If anyone could shed some light as to what i'm doing wrong it would be greatly appreciated

Thanks
Mar 26 '07 #1
2 4793
mate, don't know what really happened. because when i tested that in my way, the thing worked as it is meant to be. i am attaching here what i have done so that you can get some sort of help...

create sequence referee_seq start with 1 increment by 1;

create table testing(
id integer,
name varchar(10),
primary key(id)
);

insert into testing(id,name) values(referee_seq.nextval,'A');
insert into testing(id,name) values(referee_seq.nextval,'B');
insert into testing(id,name) values(referee_seq.nextval,'C');
insert into testing(id,name) values(referee_seq.nextval,'D');
insert into testing(id,name) values(referee_seq.nextval,'E');

One thing you can check- the data type of your primary key.
Mar 26 '07 #2
Hi

Thanks for you help mate

I tried your test and it worked fine

I had a look at my table sql and it seems that when it was created it created a trigger to increment the id automatically so when i was calling nextval it was incrementing it twice if you see what i mean.

Thanx for your help and problem is sorted now
Mar 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Hindmoor | last post by:
Hi, I am sure if anyone can help me, you guys can! I am an Informix Developer, moving to Oracle 8i and later databases. I am struggling to find the Oracle equivelant to many of the useful...
1
by: Mike Landis | last post by:
Hello, Has anyone a small tool or somekind of document which could help me to convert Oracle SQL scripts to SQL Server? Scripts are not very Oracle specified. Thanks, Below is a Script...
1
by: Ken | last post by:
Need help on the Auto Number or Identity Seed on the Oracle Database I got an Access database that need to be converted to Oracle 9i. Somehow the Trigger we created to simulate the "AUTO NUMBER"...
1
by: Ken | last post by:
I got an Access database that need to be converted to Oracle 9i. Somehow the Trigger we created to simulate the "AUTO NUMBER" on Access could not create the sequence number as soon as the value has...
4
by: dhcomcast | last post by:
We're starting to use Oracle for the back-end instead of a separate Access .mdb file for the data and everything as gone surprisingly well so far. We are learning Oracle as we go; Yikes! But we...
6
by: Steven David | last post by:
People, someone help me please. I have a webapplication, and i store the statements in xml file. Then, when i need then i took at the file. In one method of mine i have to add a record at the...
2
by: vvenk | last post by:
Hello: I am running VB.Net to access a oracle 10g table that has a sequence. This is what I tried: Dim liID As Integer = 0 Dim lodcCMD As OleDbCommand = New OleDbCommand("SELECT...
14
by: ruediger.michels | last post by:
hi, 1. is there a statement in ms sql, what creates a sequence? cant find anything in web :-( -oracle: CREATE SEQUENCE XYZ INCREMENT BY 1 START WITH 1 NOCYCLE CACHE 20; -ms sql: ??? 2....
0
debasisdas
by: debasisdas | last post by:
PL/SQL: Sequences ================ In Oracle, the sequences object provides a sequential series of numbers to applications without the overhead of disk I/O or transaction locking. These values are...
0
by: mail2sanand | last post by:
Hi all, I am facing a new issue with oracle and rails. I feel rails is expecting a sequence name associated with all the tables. The actual question is that how can we make rails...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.