DB2中的任何函数都有帮助 [英] Any function in DB2 to help

查看:78
本文介绍了DB2中的任何函数都有帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助替换愚蠢的编码,例如

SUBSTR(''0000'',LENGTH('''''),4-LENGTH('''22'')||' '22''

将字符串22更改为0022'

解决方案

he******@hotmail.com 写道:

帮助替换愚蠢的编码,如
SUBSTR(''0000'',LENGTH('''''),4-LENGTH('''22'')||'''''<更改字符串''22''到'0022''???




这真是一个愚蠢而缓慢的编码。如果我有

的机会,我会更换它。


-

Knut Stolze

DB2信息集成开发

IBM德国


一些想法:

SUBSTR(''000''||' '22'',LENGTH('''22'')


SUBSTR(右('0000''||''''',4),1,4)


DIGITS(DECIMAL(''22'',4,0))


Tonkuma写道:

一些想法:
SUBSTR(''000''||''''',LENGTH('''''')

SUBSTR(右('0000''||''22'',4),1,4)

DIGITS(DECIMAL(''22'',4,0))



我假设给定的表达式实际上只包含常量。

因此不需要对常量进行计算,而是

直接将结果写在那里。


-

Knut Stolze

D B2信息集成开发

IBM德国


to help to Replace the stupid Coding like
SUBSTR(''0000'',LENGTH(''22''),4-LENGTH(''22''))||''22''
changing string ''22'' to ''0022'' ???

解决方案

he******@hotmail.com wrote:

to help to Replace the stupid Coding like
SUBSTR(''0000'',LENGTH(''22''),4-LENGTH(''22''))||''22''
changing string ''22'' to ''0022'' ???



That is really stupid and slow coding. I would replace it if I had the
chance.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany


Some ideas:
SUBSTR(''000''||''22'',LENGTH(''22''))

SUBSTR(RIGHT(''0000''||''22'',4),1,4)

DIGITS(DECIMAL(''22'',4,0))


Tonkuma wrote:

Some ideas:
SUBSTR(''000''||''22'',LENGTH(''22''))

SUBSTR(RIGHT(''0000''||''22'',4),1,4)

DIGITS(DECIMAL(''22'',4,0))



I assumed that the given expression actually consisted of constants only.
So there would be no need to do the calculation on the constants but rather
write the results there directly.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany


这篇关于DB2中的任何函数都有帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆