sql question [message #11186] |
Wed, 10 March 2004 16:06 |
macintosh
Messages: 1 Registered: March 2004
|
Junior Member |
|
|
I got a question. I need to change the first 3 digit of phone number in the database using UPDATE statement. A 929 area code should be changed into 920. I know that I should use SUBSTR to find the first part of the 929 phone number. But I am confused how to use SUBSTR in order to concatenate 920 back onto the remainder of the number.
Below is the code that I create so far, though it still resulted in error. The examples of phone number format are: 929-763-1283, 929-498-7144.
UPDATE Table
SET Phone = '920||||Substr(Phone, 4, 9)'
WHERE Substr(Phone, 1, 3) = '929';
UPDATE Table
*
ERROR at line 1:
ORA-01401: inserted value too large for column
Thanks.
|
|
|
Re: sql question [message #11188 is a reply to message #11186] |
Wed, 10 March 2004 17:56 |
sverch
Messages: 582 Registered: December 2000
|
Senior Member |
|
|
I cannot verify it right now, but you can try something like this
UPDATE TABLE SET phone=REPLACE(SUBSTR(PHONE,1,3),'929','920');
|
|
|
|
|
|