之所以补空格因为 该长度不一的时候 有时候会导致 ORACLE数据库的子SQL 变得很多多. 导致非常慢.
ORACLE 11G 11.2.01 打补丁风险太大
只好补空格让其一直. 注意采用的字节长度
public static String formatStr(String str, int length)
{
if (str == null)
{
str="";
}
int strLen = str.getBytes().length;
if (strLen == length)
{
return str;
} else if (strLen < length)
{
int temp = length - strLen;
String tem = "";
for (int i = 0; i < temp; i++)
{
tem = tem + " ";
}
return str + tem;
} else
{
return str.substring(0, length);
}
}
本文介绍了一种通过填充字符串来优化Oracle数据库性能的方法,特别是在处理长度不一致的数据时,避免了因子SQL数量增加而导致的性能下降问题。
1240

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



