Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    55

    Unanswered: update long string cell in table by SQL command

    Hi,
    I use sqlplus in oracle (linux).
    I have a table and the string cell have long string .
    Like below :
    Code:
    column A    Column B
      
    A           BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
                BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
                .....................................BBBBBBBBBBB
    So, I need to edit/update the row A and the value in Column B.
    But the string in Column B is so long and I only need to edit one character.
    IF I use update command , I need to type very long string and
    it is easy to wrong edit .
    Any suggestion and other way to ensure the string will not type wrong ???

  2. #2
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    Just substring up to the position you want to change, then substring the rest of the column after your change:

    Code:
    update test
      set  b = substr( b, 1, 49 ) || 'X' || substr( b, 51 )
    where  a = 1
    
    Before:
    A col B( is 100 characters )
    1 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    After:
    1 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBXBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

Posting Permissions

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