View Single Post
  #2 (permalink)  
Old 04-20-2008
binary8383 binary8383 is offline
Jr. Member

Join Date: Apr 2008
Location: California
Posts: 156
BRL$: 18.33
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 27
binary8383 is on a distinguished road
Smile Re: Auto increment in Oracle

hi,

Quote:
I want to add auto increment field in oracle table. Can anyone tell me how can I add it in oracle?
you need to decide whether the auto increment field is a primary key or not.

assume that you have this table employee:-

create table employee(
id number(5),
emp_name varchar2(50),
emp_email varchar2(30)
);


then, you need to create a sequence for that employee table:-
create sequence id_incre
start with 1
increment by 1;

To use it, you can either use it in a trigger or a simple insert command as follow:-
insert into employee values(id_incre.nextval, 'binary','
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
');


Hope this will help you.

Happy trying.
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.


To receive latest updates about BRL Forums, Subscribe to Latest Updates Thread.
Reply With Quote