[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Auto Increment an ID in Oracle 10G via GUI

Posted on 2009-07-01
3
Medium Priority
?
2,012 Views
Last Modified: 2012-05-07
I'm a SQL guy; in MS SQL, I can set a Primary Key with an auto increment with whatever seed values that are needed.  Can I do this in the Oracle GUI or do I need to to do this via SQL Plus?

Thx
0
Comment
Question by:Glen_D
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 35

Expert Comment

by:johnsone
ID: 24754188
Oracle does not have an auto increment field.

You would have to create a sequence to keep track of the values.  Then you can either put the increment of the sequence into the insert statement, or you can use a trigger to generate it.
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24754225
By GUI do you mean Enterprise manager? If so, yes, but you use sequences.

There is no auto-increment column type, however, you must use the sequence in your insert statemnts for that column. You can implement auto-increment columns using a before insert trigger.
0
 
LVL 48

Accepted Solution

by:
schwertner earned 2000 total points
ID: 24754486
In Oracle you can create sequence and use it in BEFORE INSERT trigger to provide a primary key value


create table test (id number, testdata varchar2(255));


create sequence test_seq
start with 1
increment by 1
nomaxvalue;

create trigger test_trigger
before insert on test
for each row
begin
select test_seq.nextval into :new.id from dual;
end;
/

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question