Page 1 of 1

How to Inset Space as value in the Oracle table

Posted: Fri Sep 18, 2009 6:55 am
by Akumar1
Hi,
Actually we are trying to insert space value in the oracle table, but it is taking as null only.
Let me explain the issue:

We have our source as flat file which has a string column (Status varchar2 (5)) which is coming with spaces as value for some of the record, see the below example:
And I need to populate Space as it value in the oracle table as well, eventually it's not happening, in fact it is inserting the record as NULL only.

Example:
Source file:

First_Name,SSN_ID,Status
Albert,1324355,True
Martin,2456788,
James,7869899,True
Selven,2543635,
Sam,234546354,False



**Actual Output**

When I run my Datastage job it run successfully, but when I do a select query in the table:

Select * from <<tablename>> where Status is null;
<<it is resulting 2 record as NULL >>
Martin 2456788
Selven 2543635

**Expected Output**
Ideally it should not return any record with null
But I am expecting its total Length to be populated as it's VALUE
Martin 2456788 <space as it value>
Selven 2543635 <space as it value>

Posted: Fri Sep 18, 2009 6:59 am
by ArndW
What method are you using to load to Oracle? See about setting "APT_ORACLE_PRESERVE_BLANKS" to change the load behaviour on spaces.

Posted: Fri Sep 18, 2009 7:21 am
by chulett
That's pretty common Oracle behaviour in that situation and as Arnd notes, you can use that $APT variable to override it.

How to Inset Space as value in the Oracle table

Posted: Fri Sep 18, 2009 7:56 am
by Akumar1
chulett wrote:That's pretty common Oracle behaviour in that situation and as Arnd notes, you can use that $APT variable to override it. ...
All,
It worked,
thanks Again!!