NVARCHAR issue while updating Data in Oracle

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Raamc
Premium Member
Premium Member
Posts: 87
Joined: Mon Aug 20, 2007 9:08 am

NVARCHAR issue while updating Data in Oracle

Post by Raamc »

Hi All,

I have a job which update data in a table in Oracle.
While importing the metadata from datastage by using ODBC meta data connectivity, Datastage converted all VARCHAR datatypes into NVARCHAR type. I am using the same meta data while updating the same table after few joins in my job.

This job went fine when I was running it on variuos environments, now we imported the same job into other environment and trying to run.

It is throwing the following warning at each column and after few warnings job is getting aborted.

SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated

We are not geting the maximum length data, all the data is less than the specified length for each column in ODBC, then we can't understand what it is trying to truncate?

If we change datatype from NVARCHAR to VARCHAR it is running and updating the data as expected, but we can not do that change since we have used same NVARCHAR in around 20 jobs.

Can any one suggest me how to solve this issue?
Thanks,
Raamc
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Depending on the database and how it has been configured, lengths for string data types may be reported in bytes rather than in characters. You get fewer Unicode characters than you have bytes.

What lengths are reported when you import the table definition? Use these.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Raamc
Premium Member
Premium Member
Posts: 87
Joined: Mon Aug 20, 2007 9:08 am

Post by Raamc »

Length's are same for all the columns Ray. Only VARCHAR to NVARCHAR and CHAR type to NCHAR are converted while importing the metadata.

And regarding the UNICODE, can you please explain a bit more?
Thanks,
Raamc
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A column may be declared, for example, as VARCHAR2(20 BYTES) or VARCHAR2(20 CHARACTERS). The latter takes up 60 bytes in Oracle. You can get DataStage to manage it properly if declared as VarChar(60).

There is a setting in Oracle to switch the default from BYTES to CHARACTERS or vice versa, but I can't recall what it is. I *think* it's been described on DSXchange previously.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Done via length semantics but not something I find DBA peoples are willing to change. Typically.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply