Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Red face Unanswered: Auto Number in Field

    Dear DB'ers,

    How to set a table for generate auto number in field.
    Example: I have 2 fields, field1 = NUMBER and field2 = VARCHAR2;
    If I have insert new data in field2, field1 must be generate sequence auto number.

    This case, like in SQL Server put Identity, Identity Seed and Identity Inc.

    How to that in ORACLE 9 ????

    Thanks

    regards,

  2. #2
    Join Date
    Feb 2004
    Location
    inida
    Posts
    62
    Try to create a trigger like this.

    TRIGGER generateId
    before insert or update on supplier
    for each row
    begin
    select s_sequence.nextval
    into :new.sid
    from dual;
    end;

    here supplier is the table name.
    s_sequence is the sequence created.

  3. #3
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    273
    Oracel can do better than what other DBMS can do.

    You can acomplish this task by creating and using SEQUENCE.

    You go to http://download-west.oracle.com/docs...views.htm#3569 form
    for more information.

    HTH
    Bhavin

    MS Computer Science
    OCP DBA 9i/8i

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •