Kaushik
Kaushik

Reputation: 9

Auto sequence incrementer at database

I'm new to programming, so need little help from you guys.

I created a simple registration from in HTML controlled by servlet using oracle. Whenever i submit my record, it gets stored perfectly in database, but I have assigned ID for every stored record which is not appearing to be increment in ascending order even after assigning primary key to ID.

Upvotes: 0

Views: 107

Answers (2)

Gaurava Agarwal
Gaurava Agarwal

Reputation: 984

There is no short way to auto increment id in database itself. This post describes good way to do it in oracle.

How to create id with AUTO_INCREMENT on Oracle?

Upvotes: 1

Rahul Vedpathak
Rahul Vedpathak

Reputation: 1436

Use a database sequence. And increment it by 1 every time you take a new value from that DB sequence.

Upvotes: 0

Related Questions