Solved

Oracle SQLPlus Autonumber

Posted on 2004-03-29
3
1,305 Views
Last Modified: 2010-07-27
Hello,

I'm using Oracle SQLPlus and I was wondering if there was any way of declaring a field as both a primary key and an autonumber??? I need to do this using ONLY SQL plus, not forms builder or anything else!

At the moment, the create table statement looks like:

create table customer
 (CUSTID number(4) not null primary key, ..........)

so can I turn CUSTID into an autonumber here?

Thanks
0
Comment
Question by:tigermoth
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
baonguyen1 earned 50 total points
ID: 10703743
No, you can not do that.  You have to create a sequence then specify it in the insert command or write a trigger insert the sequence every insert. There is no default autonumber option in create table command as you wish.

Hope this helps
0
 

Author Comment

by:tigermoth
ID: 10703999
and if you fancy some more easy points, you can try helping me here:

http://www.experts-exchange.com/Databases/Q_20935831.html
0
 

Author Comment

by:tigermoth
ID: 10704045
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now