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
Solved

Auto Increment an ID in Oracle 10G via GUI

Posted on 2009-07-01
3
1,771 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
3 Comments
 
LVL 34

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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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 information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

838 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