When updating a DB2 table using the DB2/UDB stage I'm trying to get the database to calculate the field value based on the columns I pass it but it's treating what I pass it as a string not a calculation for DB2 to execute. For example: If I run this statement in Command Center it works and the numeric value of the calculation is displayed on the table properly.
UPDATE TABLE
SET EP_NUMERATOR=SCDLR_EFF_HRS + SCDLR_UNPAID_BREAK_HRS
WHERE FIELDA = '01'
Note:Both SCDLR_EFF_HRS and SCDLR_UNPAID_BREAK_HRS are fields on TABLE.
But when I run this in Datastage
UPDATE TABLE
SET EP_NUMERATOR=?
WHERE FIELDA = '01'
Note: '?' is resolved from the incoming file which has the calculation SCDLR_EFF_HRS + SCDLR_UNPAID_BREAK_HRS (no quotes either in the file)
The error I get is that 'EP_NUMERATOR has been truncated to SCDLR_EFF_HR'
So it looks like DataStage is trying just to pass this equation in as a String into the field which is defined as a decimal.
Is what I'm trying possible in DataStage and I'mjustmissing something or does DataStage need an actual value to update?
Thanks
Using a Formula instead of value to populate a field in DB2
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
[quote="Sainath.Srinivasan"]Do you mean you want the formula to be dynamically substituted ?
If it is always addition, why not do in datastage and pass the result ?
You need to provide more information. ...[/quote]
Yes, I want the formula substituted. The formula is not always the same and can change per row and per run. Ultimately each row will have 5 seperate buckets all containing different formulas. Right now I'm just trying to get one to work.
If it is always addition, why not do in datastage and pass the result ?
You need to provide more information. ...[/quote]
Yes, I want the formula substituted. The formula is not always the same and can change per row and per run. Ultimately each row will have 5 seperate buckets all containing different formulas. Right now I'm just trying to get one to work.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom