1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Creating a table with two identity columns

Discussion in 'SQL PL/SQL' started by ramakishore, Feb 16, 2009.

  1. ramakishore

    ramakishore Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    Hello guys,

    I have a question

    Can we create a table with two identity columns in ORACLE.
    I know only in Ingres database.

    Thanks in advance,
    Sriram
     
  2. tyro

    tyro Forum Genius

    Messages:
    368
    Likes Received:
    20
    Trophy Points:
    260
    Location:
    India
    hi ram.. i can feel your situation here.. cos i have some friends who work in sql server and can't figure out why there's no such thing as an Identity column in oracle...

    but coming to the point,

    There's no such Thing as an Identity column in Oracle. The same functionality is obtained by Primary Keys as u would probably already know. You can specify one (or more) columns as your PK while creating your table. You can insert a new number in the PK column by either using seq_name.nextval or use a Pre-insert trigger.
     
  3. ramakishore

    ramakishore Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    Thanks for immediate response,

    I will try this and let you know the results
     
  4. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    The following link will be useful for you reference .

    Autonumber
     
  5. bsrinu27

    bsrinu27 Active Member

    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    85
    Location:
    hyderabad
    cant create table with duplicate column names
     
  6. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Table can't be created with duplicate column name.