Varchar2(CHAR) data type in DS???

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
Vijay Kumar
Participant
Posts: 59
Joined: Sat May 29, 2004 12:31 am
Location: Pune

Varchar2(CHAR) data type in DS???

Post by Vijay Kumar »

Hi,
I require few clarifications in DataStage Data Types and Tranformer functionality

1) Which data type in DataStage represents Varchar2(CHAR)data type in Oracle?

2) will the data get truncated if we assign Varchar2(200) input field to Varchar2(50) output field in transformer stage and write the data to a Sequential file ? If Yes, will it get truncated based on Number of Bytes or Number of Characters?

Any pointers or views on above points are helpful.

Regards,
Vijay
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Vijay,

The datatype you can use in DataStage is VarChar() and DataStage "thinks" in terms of characters unless you have NLS installed.
Vijay Kumar
Participant
Posts: 59
Joined: Sat May 29, 2004 12:31 am
Location: Pune

Post by Vijay Kumar »

ArndW wrote:Vijay,

The datatype you can use in DataStage is VarChar() and DataStage "thinks" in terms of characters unless you have NLS installed. ...
ArndW,
Do I need to declare Varchar2(50 CHAR) as Varchar(50) or Varchar(200)
since NLS_CHARACTERSET=ALT32UTF8 and NLS_NCHAR_CHARCTERSET=ALT16UTF16 in Oracle database.

If I declare it as Varchar(50) then Job Log shows warning messages-

Implict conversion from source type 'string max[200] to result type max=50. Possible truncation of variable length string

I have posted the above issue clearly in another post( Regarding Oracle Enterprise Stage Warnings)
DataStage "thinks" in terms of characters unless you have NLS installed. .
NLS is not installed- But in future if we install NLS, then will the DataStage think in terms of bytes instead of Characters???

If we declare Varchar(50) for a sequential file- will it accept 50 character or 50 bytes of data??

Regards,
Vijay
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I made a mistake in my first post, DataStage always thinks and works in terms of characters; but with NLS installed a character can be more than one byte.

You declare VarChar(50) for a 50-character field. The rep
Vijay Kumar
Participant
Posts: 59
Joined: Sat May 29, 2004 12:31 am
Location: Pune

Post by Vijay Kumar »

ArndW wrote:I made a mistake in my first post, DataStage always thinks and works in terms of characters; but with NLS installed a character can be more than one byte.

You declare VarChar(50) for a 50-character ...
But If I declare it as Varchar(50) the job log shows warning message.

Implict conversion from source type 'string max[200] to result type max=50. Possible truncation of variable length string

How to avoid this??
If I declare it as Varchar(200)- it does not show any warnings- Can I follow the below steps?

1) In Oracle Enterprise Stage I will declare it as Varchar(200) though the Oracle Data type is Varchar2(50 CHAR)
2) In transformer I will convert Varchar(200) to Varchar(50) and write to a sequential fiel with Varchar(50)(since DS interprets everything in terms of characters and not interms of bytes I presume that there wount be any data truncation in this case)

Kindly let me know whether my perception is correct or not

Regards,
Vijay
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, declare it with length of VarChar(200) and put a LEN() check when you truncate to 50.
Post Reply