-
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
-
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
-
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;
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|