Converting Varchar to Decimal

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Converting Varchar to Decimal

Post by bapajju »

Hello,

We have a data source which is a Sequential file. All the fields in that file are defined as Varchar. But in the target (teradata) database couple of fields are defined as Decimal as they are some Quantity fields. Now if a blank value come from the source file the datastage job throws and error saying that "Can not convert "" to long type". We tried to change the blank values to NULL, but still it does not work out. Can anyone help on this, please.

Thanks in advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

By 'NULL', do you actually mean @NULL?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Check the Format tab of your Sequential File stage. If the "null representation" field is empty, "" ought to be translated to null. Also check the Columns grid in case the null representation has been overridden on a per-column basis - you will need to scroll right to find this setting.

Otherwise, include an "empty to null" transformation in your Transformer stage.

Code: Select all

(If InLink.TheColumn = "" Then @NULL Else InLink.TheColumn)
Last edited by ray.wurlod on Fri Jun 23, 2006 3:49 am, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply