Updating 1st 5 digit of a column value in sql

Hi ,

I need assistance here for updating 1st 5 digit of a column value

for E.g i have value 999999999 (9 digit) and i need to replace 1st 5 digits with 11111

output should look like “111119999”

However, in the same column i have value called “MIS” i dont want to touch those value

what query should i use in Oracle sql developer.

What I have tried:

I have tried various update query like

Hide Copy Code

UPDATE table SET TAX_ID = replace(TAX_ID, '4', '1111');

I’m not an Oracle coder, but it should be roughly…

UPDATE table SET TAX_ID = "11111" || SUBSTR(TAX_ID,6) WHERE TAX_ID != "MIS"

2 Likes
UPDATE table 
   SET TAX_ID = '11111' || SUBSTR(TAX_ID, 6)
 WHERE TAX_ID <> 'MIS'
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.