This discussion is archived
2 Replies Latest reply: Dec 8, 2012 12:50 AM by phaeus RSS

Add Sequence to an existing table

978734 Newbie
Currently Being Moderated
How can I add a Sequence to an existing table in a new field called the User_Id? I'm using Oracle SQL Developer version 3.0.04, and it provides an option to create a sequence, which I did, called Log_Seq. So I need to put this sequence in the table Final_Log under a column named User_Id. I'm stuck at this part. I would appreciate any help I can get!
  • 1. Re: Add Sequence to an existing table
    P.Forstmann Guru
    Currently Being Moderated
    You don't "add" a sequence to an existing table at least in existing Oracle versions. A database sequence is an database object that application code must manage with specific SQL data manipulation language (DML) statements. You need to modify application code to add or modify SQL statements.

    See example from Admin. Guide http://docs.oracle.com/cd/E11882_01/server.112/e25494/views002.htm#ADMIN11796 .
  • 2. Re: Add Sequence to an existing table
    phaeus Pro
    Currently Being Moderated
    Hello,
    what you can do is to add a trigger to the table which do the work for you.

    For example:
    http://www.razorsql.com/features/oracle_add_sequence_trigger.html

    regards
    Peter

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points