Empty spaces in OCI Target table
Moderators: chulett, rschirm, roy
Empty spaces in OCI Target table
Hi all,
I have created a simple job that reads data from the source table through ODBC stage and writes it to an Oracle target table( I am using a OCI stage) through a transformer. The only transformation I do in the transformer is to find out if there are any empty spaces in the source table and write them as NULL into my target table. The job finishes succesfully, however, I still can see some empty spaces in my target table instead of NULL values. Did anyone come across this kind of issue? Any sort of help would be great.
Additional Info:(thought this mite help)
The data in the source table consists of rows containing data, empty spaces and NULL values. Now, when I pull this data into an ODBC stage, the NULL values come in as empty spaces. So, in my ODBC stage I have rows containing data and empty spaces. But in Target table, only those rows are written as NULL which are empty in source table, and the rows which contain null values in the source are written to target as empty spaces. Please let me know if I am not clear so that I could explain it again in a more detailed way.
I have created a simple job that reads data from the source table through ODBC stage and writes it to an Oracle target table( I am using a OCI stage) through a transformer. The only transformation I do in the transformer is to find out if there are any empty spaces in the source table and write them as NULL into my target table. The job finishes succesfully, however, I still can see some empty spaces in my target table instead of NULL values. Did anyone come across this kind of issue? Any sort of help would be great.
Additional Info:(thought this mite help)
The data in the source table consists of rows containing data, empty spaces and NULL values. Now, when I pull this data into an ODBC stage, the NULL values come in as empty spaces. So, in my ODBC stage I have rows containing data and empty spaces. But in Target table, only those rows are written as NULL which are empty in source table, and the rows which contain null values in the source are written to target as empty spaces. Please let me know if I am not clear so that I could explain it again in a more detailed way.
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Hi Kris,
You can write the target column derivation as:
Let me know if it worked.
Thanks,
Naveen.
You can write the target column derivation as:
Code: Select all
If
Len(Trim(Outlink.Col)) = 0 or Outlink.Col = ''
Then
''
Else
OutLink.Col = InLink.Col
Code: Select all
Note: '' is for NULL, meaning there is no space between the quotes.
Thanks,
Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
I afraid NULL is quite different from '' Empty string.naveendronavalli wrote:Hi Kris,
You can write the target column derivation as:
Code: Select all
If Len(Trim(Outlink.Col)) = 0 or Outlink.Col = '' Then '' Else OutLink.Col = InLink.Col
Let me know if it worked.Code: Select all
Note: '' is for NULL, meaning there is no space between the quotes.
Thanks,
Naveen.
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
@NULL can be used rather.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Hi Naveen,
Thanks for that.
It worked fine for columns whose datatype is varchar2 but didnt work for column whose datatype is number. Am I missing something out over here.
please let me know. And as Kumar mentioned..NULL is different from empty string. But I need NULL at my ouput..so I used 'NULL' instead of ''.
Thanks guys
-Kris
![Smile :)](./images/smilies/icon_smile.gif)
Thanks for that.
It worked fine for columns whose datatype is varchar2 but didnt work for column whose datatype is number. Am I missing something out over here.
please let me know. And as Kumar mentioned..NULL is different from empty string. But I need NULL at my ouput..so I used 'NULL' instead of ''.
Thanks guys
-Kris
![Smile :)](./images/smilies/icon_smile.gif)
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Hi kumar,
Thanks for correcting me. I should have double-checked.
Yes. Empty String <> NULL
In Fact the code should be:
Sorry! Kris. I hope you corrected it.
Many Thanks,
Naveen.
Thanks for correcting me. I should have double-checked.
Yes. Empty String <> NULL
![Smile :)](./images/smilies/icon_smile.gif)
In Fact the code should be:
Code: Select all
If
Len(Trim(Outlink.Col)) = 0 or Outlink.Col = @NULL
Then
@NULL
Else
OutLink.Col = InLink.Col
Many Thanks,
Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Naveen is there a difference between Outlink.Col = '' and Outlink.Col = ""
please note the difference in cotes
please note the difference in cotes
M.T.Anwer
The day the child realizes that all adults are imperfect he becomes an adolescent;
the day he forgives them, he becomes an adult; the day he forgives himself, he becomes wise.
-Aiden Nowlan
The day the child realizes that all adults are imperfect he becomes an adolescent;
the day he forgives them, he becomes an adult; the day he forgives himself, he becomes wise.
-Aiden Nowlan
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
MTA,
There is no difference between '' and "". Both are the same.
But it is quotes and not cotes.
thanks,
Naveen.
There is no difference between '' and "". Both are the same.
But it is quotes and not cotes.
thanks,
Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Issue solved.
I got my issue solved. I declared the datatype as a number in the target table and was trying to write "NULL" if its an empty string. And hence the job was getting aborted because the table is reading "NULL" as an invalid number. I can't believe I missed that. Thanks once again guys.
:D
Kris
:D
Kris