Page 1 of 1

Padding blank spaces behing the passed string in Oracle

Posted: Mon May 12, 2008 1:19 am
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

Re: Padding blank spaces behing the passed string in Oracle

Posted: Mon May 12, 2008 1:51 am
by vkhandel
have u tried trimming using the function -

Left(Trim(col_name),Len(Trim(col_name)))

Posted: Mon May 12, 2008 3:37 am
by tsn
Check at lookup place also, whether you have used trim, try left(trim(col.name)). I hope it will work.

Posted: Mon May 12, 2008 4:17 am
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.

Posted: Mon May 12, 2008 6:34 am
by ray.wurlod
Moderator: please move to parallel forum

Posted: Mon May 12, 2008 7:09 pm
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.

Posted: Tue May 13, 2008 7:04 pm
by BillB
As a workaround, trimming the column thro' close command....

many thanks