更新值的前5位数 [英] Update 1st 5 digit of value
问题描述
我需要帮助来更新列值的前4位数
对于Eg,我的价值为999999999(9位数),我需要用11111掩盖前5位数字
输出应该看起来像111119999
然而,在同一列中我有一个名为MIS的值我不想触及那些值
我应该使用什么查询在Oracle sql开发人员中。
我的尝试:
我尝试了各种更新查询,例如
UPDATE表SET TAX_ID = replace(TAX_ID,'4','1111');
更新 表
SET TAX_ID = STUFF(TAX_ID, 1 , 4 ,' 1111')
WHERE TAX_ID NOT LIKE ' %MIS%';
假设字符串'MIS'可以存在于现场的任何地方。
BTW,你的两个第一句话互相矛盾,你想更新前四个吗?或者五个字符?
使用这个
var res =1111+ TAX_ID.Substring( 4);
Hi ,
I need assistance here for updating 1st 4 digit of a column value
for E.g i have value 999999999 (9 digit) and i need to mask 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
UPDATE table SET TAX_ID = replace(TAX_ID, '4', '1111');
UPDATE table SET TAX_ID = STUFF(TAX_ID,1,4,'1111') WHERE TAX_ID NOT LIKE '%MIS%';
Assuming the string 'MIS' can exist anywhere in the field.
BTW, your two first sentences are contradicting each other, do you want to update the first four or five characters?
Use this
var res = "1111" + TAX_ID.Substring(4);
这篇关于更新值的前5位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!