PDA

View Full Version : Trimming Spaces



jay.harris@nisc.coop
01-19-2008, 11:13 AM
I've tried several methods to concatenate 2 columns.

mstr_type is 1 character
mstr_item is 60 characters

My SELECT is:

select max(ltrim(rtrim(z.mstr_type))) as ma_mstr_type
,upper(ltrim(rtrim(z.mstr_item))) as ma_mstr_item
,cast (count(*) as number(1,0)) as row_count
from (select a.ma_item as mstr_item, a.ma_type as mstr_type
from ma_mstr@absrdbma a
union all
select a.ma_item as mstr_item, null as mstr_type
from ma_non_inv@absrdbma a
) z
group by z.mstr_item
order by z.mstr_item

My JAVA step is:
XREF_OLD_VALUE = (MA_MSTR_TYPE.Clone() + MA_MSTR_ITEM.Clone());
XREF_NEW_VALUE = (MA_MSTR_ITEM.Clone() + MA_MSTR_TYPE.Clone());

When I preview the JAVA step, I get the following results:

XREF_NEW_VALUE
39931394 S
65001757 S
69113949 S

I'm getting spaces between mstr_item and mstr_type.

I hope I've giving you enough information.

Jay Harris

jay.harris@nisc.coop
01-21-2008, 11:30 AM
Solution.

XREF_OLD_VALUE = (MA_MSTR_TYPE.Clone().getString() + MA_MSTR_ITEM.Clone().getString());
XREF_NEW_VALUE = (MA_MSTR_ITEM.Clone().getString() + MA_MSTR_TYPE.Clone().getString());

Thanks to my collegue Jon Kilber :)