random student
random student

Reputation: 775

IBM Datastage : Creating column that is calculation

I have a table which columns are location and credit, the location contains string rows which mainly is location_name and npl_of_location_name. the credit contains integer rows which mainly is credit_of_location_name and credit_npl_of_location_name. I need to make a column which calculates the ((odd rows of the credit - the even rows of the credit)*0.1). How do i do this?

Upvotes: 0

Views: 235

Answers (1)

Ray Wurlod
Ray Wurlod

Reputation: 851

When you specify "odd rows" and "even rows" are you referring to row numbers? Because, unless your query sorts the data, you have not control over row order; the database server returns rows however they are physically stored.

Once you are sure that your rows are properly sorted, then you can use a technique such as Mod(@INROWNUM,2) = 1 to determine "odd" and zero is even. This works best if the Transformer is executing in sequential mode; if it is executed in parallel mode then you need to use a partitioning algorithm that ensures that the odd and even rows for a particular location are in the same node.

Upvotes: 1

Related Questions