update sys_adcdyear s set s.pcode=(select rpad(substr(t.code,1,2),'15','0') as code1 from sys_adcdyear t where t.lvl='3' and s.code=t.code) where lvl='3' 为pcode补全15位,全部为0
其中rpad为向右补全函数,其中的参数包括(param1,param2,param3) param1表示要补全的字段,param2表示补全位数,param3表示补全类型
本文介绍了一种使用SQL中的rpad函数对特定字段进行位数补全的方法,具体应用场景为将年份代码字段补全至15位,不足部分用0填充。此方法适用于需要标准化数据长度的情况。
960

被折叠的 条评论
为什么被折叠?



