how to update part of the column data [message #53868] |
Tue, 15 October 2002 10:34 |
Eugene
Messages: 44 Registered: August 2001
|
Member |
|
|
Hi all,
Could someone help me to update part of the column.
If I do:
Update table_1
Set substr(col_1,10,4) = 'Blah';
I get error: missing equal sign
Is there a way to do it? Is there a built-in function in Oracle to perform it?
Thanks,
|
|
|
|
Re: how to update part of the column data [message #53874 is a reply to message #53872] |
Tue, 15 October 2002 11:04 |
Eugene
Messages: 44 Registered: August 2001
|
Member |
|
|
Thank you for your reply.
Why is this method not recommended?
What is the difference between doing that as oppose to doing something like that:
update table_1
set col_1 = substr(col_1,9)||'Blah'||substr(col_14)
Regards,
|
|
|
Re: how to update part of the column data [message #53876 is a reply to message #53872] |
Tue, 15 October 2002 11:29 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
Mahesh's solution is fine, if you aren't worried about the position of the change. If you only want to update a specific region of the field, then you need to use substr() to restrict the region. You can mix and match approaches. As long as your algorithm is robust and handles exception cases correclty (null fields, fields shorter or longer etc) and there is no major performance difference then the solution is fine.
|
|
|