Convert Oracle RAW 16 to Td

Database
Highlighted
Teradata Employee

Convert Oracle RAW 16 to Td

Hello to all,

I'm trying to load a column RAW 16 from Oracle into Teradata, the target column has been defined as VARBYTE 16 but I'm afraid there's something wrong.

Before loading the target table, I load a table with the field defined as VARCHAR 16.

To load it on the DB use the string TO_BYTES (TRANSLATE ('ColumnTarget' USING LATIN_TO_UNICODE), 'base16') taken from the support table.

At this point the string becomes unreadable, using TO_BYTES (TRANSLATE ('ColumnTarget' USING LATIN_TO_UNICODE), 'base16')

Can you help me to read this data correctly so I can join this field?

Regards

 

3 REPLIES
Teradata Employee

Re: Convert Oracle RAW 16 to Td

You don't say how the data is getting from Oracle to the Teradata staging table, but it sounds like this is Latin or ASCII character data.  If that is the case then you should be able to read it if you simply define the column in the staging table as VARCHAR(64000) Character Set LATIN.

Teradata Employee

Re: Convert Oracle RAW 16 to Td

Thank you,

unfortunately the program used for replicating from the Oracle source to the destination Td, change data capture, does not accept the output varchar.

 

Regards

Junior Contributor

Re: Convert Oracle RAW 16 to Td

Oracle's RAW is binary data similar to Teradata's BYTE.

When you export it as-is (i.e. as binary data) you should be able to load it into a VARBYTE(16).

But if it's coverted to a Hex-string (e.g. '1234567890abcdef') you should load it into VARCHAR(32) and then apply

To_Bytes(ColumnTarget, Translate('Base16' USING unicode_to_latin))