Padding blank spaces behing the passed string in Oracle

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
BillB
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 13, 2007 6:44 pm

Padding blank spaces behing the passed string in Oracle

Post by BillB »

Hello All,

I have found that using APT_ORACLE_PRESERVE_BLANK = True option also Pads blank spaces behing the passed string.

i.e. eventhough i pass only 5 or 6 or 7 characters to a field defined as Varchar2(12) in database

it is actually stored as 12 instead of 5 or 6 or 7 characters padding blank spaces behind the sting which causes problem while lookup.

Database: Oracle 10i
Wrtite Mode: LOAD -> truncate

tried all sort of way like trim,trimb or trimF or index of left but did not work etc...

Please suggest how to resolve this issue.

Thank You
vkhandel
Participant
Posts: 35
Joined: Wed Oct 04, 2006 12:12 am
Location: Pune

Re: Padding blank spaces behing the passed string in Oracle

Post by vkhandel »

have u tried trimming using the function -

Left(Trim(col_name),Len(Trim(col_name)))
tsn
Participant
Posts: 51
Joined: Wed Jan 10, 2007 1:32 am

Post by tsn »

Check at lookup place also, whether you have used trim, try left(trim(col.name)). I hope it will work.
with regards,
tsn
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I'm not at a system where I can check, but I seem to remember that Oracle VarChar() and VarChar2() act a bit differently when it comes to padding. Can you try to export a VarChar() column as well and see if it is still padded to a fixed length; I think it might not be.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Moderator: please move to parallel forum
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
BillB
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 13, 2007 6:44 pm

Post by BillB »

As I mentioned,despite of use of Trim or its derivative,its still padding while loading into database.
ArndW

I'm not at a system where I can check, but I seem to remember that Oracle VarChar() and VarChar2() act a bit differently when it comes to padding. Can you try to export a VarChar() column as well and see if it is still padded to a fixed length; I think it might not be.
How to workout this as when I am changing datatype from VarChar2() to VarChar() still its appearing as VarChar2() in table.
BillB
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 13, 2007 6:44 pm

Post by BillB »

As a workaround, trimming the column thro' close command....

many thanks
Post Reply