Data type from varchar2 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
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

Data type from varchar2 to decimal

Post by vivek »

Hi Gurus,
I have a column in my source(oracle) which is of Varchar2 data type.It is a column which has two constant vaues TRUE and FALSE.
But in the target(Oracle), same column's datatype is decimal.When i tried loadingi am getting Nulls.
Please give your valuable suggestions to overcome this issue.
(Actually i tried changing the data type of the target column, but still i am not getting the out put.)
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

There should be a field level mapping give to you. Or look into the given buisness rules. There might be some code change involved. Somting like 1--> True; 0 --> False. Use transformer to acheive this.
And dont try acheive somting new by fiting charecters into decimal field.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

Post by vivek »

Kumar,
You are right. In the target The True or False becomes 1 AND 0. Can you explain me how to achieve this in the tarnsformer?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's just a simple if-then-else statement in your derivation. This is not something you've had to do before? :?

The only thing that might 'complicate' the process a little is if there may be values other than TRUE or FALSE in the field, or if it might come in various cases or if it could possibly be null.

If that's the case, we'd need to know the transformation rules for those situations but it still should be very straight-forward. Why not take a shot a doing it yourself and see if you can work it out rather than waiting for someone to spoon-feed you an answer?

Post back with a more specific question if you run into a problem.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It would be:
If Columnname = True then 1 else if Columname = False then 0 else @NULL.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

[sigh]

Not quite right. How 'bout we let Vivek work it out from there as a learning exercise rather than pick up the spoon again?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Craig,
What I meant was just a logical head start for the poster. Dint mean to solve the problem :D


chulett wrote: How 'bout we let Vivek work it out from there as a learning exercise rather than pick up the spoon again?
Very True
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
dls
Premium Member
Premium Member
Posts: 96
Joined: Tue Sep 09, 2003 5:15 pm

Post by dls »

vivek, a simpler approach may be to DECODE your source value. See Oracle's DECODE function.
Post Reply