Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto increment of number

Status
Not open for further replies.

rk68

Programmer
Jul 15, 2003
172
IN
I'm newbee in Oracle 9i forms. I have a created a form which has a tracking number (primary key). When a user adds a record, the tracking number should automatically increment OR when the record is saved.
1) How can this be done ?
2) What if more than 1 user adding records, how will the tracking no. gets updated ?
3) Can I display the tracking no. at time of entry ?

Thanks
Raj
 
If you dont need the numbers to be guaranteed consecutive, then use a sequence.
 
Can I do without sequence, if yes, how ?
The number is a redemption tracking no. & it has to be a genuine number.
 
Code:
CREATE SEQUENCE YourNumberSequence 
    INCREMENT BY 1 
    START WITH 1 
    MAXVALUE 99999999 (or NOMAXVALUE) 
    MINVALUE 1 (or NOMINVALUE) 
    CYCLE (or NOCYCLE - the default) 
    CACHE n (or NOCACHE) 
    ORDER (or NOORDER)

to use

Code:
INSERT INTO YourTable 
    ( RowID, OrderDate, SalesPerson ) 
    VALUES ( YourNumberSequence.NEXTVAL, SYSDATE, 'DugsDMan' );

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
Sorry to ask this silly question but can't help.
Where do I create the 'sequence' in the form & where do I
put the 'Insert' SQL ?
Since I'm using the default Oracle tool bar & menu do I need to have the save button ?

Thanks
Raj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top