1. The Forum has been upgraded to a modern and advanced system. Please read the announcement about this update.
  2. 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!

How to change partial column value in a table

Discussion in 'SQL PL/SQL' started by Veetri, Jan 8, 2010.

  1. Veetri

    Veetri Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    I want to change the partial value of a column in a table using SQLPLUS. For example, I want to replace <fname>.<lname>@domain.com to <fname>.<lname>@newdomain.com. I want the sql to go through the table and replace just the domaan part of the email column. Is this possible to do with a sqlplus command? Thanks.
     
  2. nukala ramji

    nukala ramji Guest

    hi,
    i understood ur query.
    the solution for this query is just by using the string functions ,we can achive the goal.

    here is the solution for your query....


    Code (SQL):
    UPDATE tab_name SET email = substr(email,1,instr(email,'@',1,1)-1)||'@ur_newdomain.com'
    in above query tab_name --> table name
    email ----> column name.
    i think it can help u.
    do u have doubts in the above query ....feel free to mail me at ramamohan.nukala@gmail.com
     
  3. Veetri

    Veetri Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    Thank you. I did use almost the same command before but had an extra || at the end. Anyway, the command you had worked great. Thanks again. :)