DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: populating colums from other columns

  1. #1
    Join Date
    Nov 2001
    Posts
    27
    Hi.

    Is there a way that I can create a column that will hold the first two characters of the values from another column ?

    The existing column already has populated rows. I just need to take the first two characters of the values of this column and populate another column in the same table.

    I hope I didn't confuse anyone.

    Please anyone help. THANKS

    By the way, I'm running Oracle8i on Linux.

  2. #2
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Hi,
    no matter where's you Oracle running:
    Code:
    update your_table
    set new_column=substr(another_column,1,2);
    commit;
    to add a column to the table:
    Code:
    alter table your_table add new_column char(2);
    HTH,
    Ales

  3. #3
    Join Date
    Nov 2001
    Posts
    27
    Thanks. It works perfect.

Posting Permissions

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


Click Here to Expand Forum to Full Width