query

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
iskapalli
Participant
Posts: 76
Joined: Wed Jul 25, 2007 12:36 am

query

Post by iskapalli »

Hi,

my job

td stage ----> trans-----> tdstage.

I have written custom query in the teradata connector stage(source).

select sum(reslt_1) from table group by master_trim_id.

result_1 decimal(16,2).

BUT job is failed. it is expexting decimal(18,2)
after useing cast function my job is running fine,
select cast(sum(reslt_1) as decimal(18,2) from table group by master_trim_id.

my question is datastage will take default length for decimal values?
and is there any other way to resolve this issue.?
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: query

Post by SURA »

Find what is the return type of SUM funcation. It is int and you declared the data type as decimal.

So you need to conversion and that worked when you use the cast.


This is my understanding.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
iskapalli
Participant
Posts: 76
Joined: Wed Jul 25, 2007 12:36 am

Post by iskapalli »

I chekced return type of SUM funcation. it is takeing as decimal(18,2).

could you please let me know what basis it is takeing as decimal(18,2).
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It probably is simply allowing two extra digits of precision (without changing scale) on the premise that the sum will be larger than any of the individual elements of the sum and, as a rule of thumb, allowing the sum to be about 100 times larger than any other element. (And that at the lower bound of uncertainty.)
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