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

Thread: UPDATE

  1. #1
    Join Date
    Jul 2001
    Posts
    334
    I have a column NAME VARCHAR2(30). In this column first name is already stored for e.g.:
    NAME
    ------
    Davis

    Now few days later what we have to do update NAME column
    With last name also, but the problem is we do not want to remove first name the column should be looks like

    NAME
    --------
    Davis George

    * We do not want to update entire first & last name with first name (Davis). Simply first name should be remaining as it is and last name should update concatenate with first name.

    I know the requirement is very different, but please I need help to solve the issue. I would really appreciate if any one can help/suggestion.

    Thanks

  2. #2
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    Not only is the requirement 'different', it is bad. If first name and last name are provided separately, then, by all means, they should be stored seperately!

    What is wrong with having separate FirstName and LastName fields? They can always concatenate them in the SELECT. If that's too difficult, you can create a view that concatenates the names for them. If that's still too difficult, you can create a third column that is populated via a trigger and let them select from there.

    Now, assuming that you have considered all those and *still* feel the need to implement such a design, you cannot get around the need to concatenate the existing value with the new text:

    Code:
    UPDATE
       Table1
    SET
       Name = Name || ' George'
    WHERE
       Table1_ID = 1
    HTH,

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

  3. #3
    Join Date
    Sep 2001
    Location
    Dallas, TX
    Posts
    27

    UPDATE

    Hi,

    Correct me if I'm wrong. Here's what the statement should look like :

    UPDATE x SET first_name = first_name || last_name;

  4. #4
    Join Date
    Jul 2001
    Posts
    334
    Thanks Chris & Bkrish, I have checked both tech. are working. ok

    Thanks for the help.

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