20 Padded in Data

UDA
Enthusiast

20 Padded in Data


Hi,



I am new to Teradata. We are using Teradata as Our database in Datastage. Data is extracted from Oracle (xml format) and loading that to Teradata tables (multioload)



Datastage i am using Projects level PAD_CHAR as 0x0.



Target column is EMP Char(11) in teradata



When i am trying to convert emp_id to hexa decimal data is showing with 20 as padded



Char2HexInt(EMP_ID)             EMP_ID

------------------------------------------------

3030323530383320202020   0025083



If any spaces are there it will pad with 20, but my source data doesn't have any spaces.  Please suggest what was the issue.



 



 



 



 


4 REPLIES
Senior Apprentice

Re: 20 Padded in Data


If you pad a string with 0x0 it will be stored as is, thus the data sent to Teradata seems not to be padded.



But why do you want hex 0 as a pad character?

Those 0x0 are usually shown by the client as blanks.



WHERE emp_id = '0025083' will not evaluate to true, you'll need

WHERE emp_id = '0025083' || '00000000'xc instead.



No user/client tool will know that.



Dieter


Enthusiast

Re: 20 Padded in Data

By default Project level we assigned PAD_CHAR as 0x0. In the same project for the remaning jobs CHAR column values are padded with '000000' if we convert that as hex".

Only for two tables we are getting CHAR columns data padded wih 20202020.

Please suggest whether is this issue with source data ?

Senior Apprentice

Re: 20 Padded in Data

Only you can find out whether it's an issue with source data or your ETL tool or whatever.

But i still suggest it's stupid to use trailing 0x0 in a CHAR column.

Dieter

Enthusiast

Re: 20 Padded in Data

Thanks..we  made 0x20 at project level.