Lookup using a Order by clause

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
sandyindu
Participant
Posts: 1
Joined: Mon May 14, 2007 5:12 am

Lookup using a Order by clause

Post by sandyindu »

In one of our jobs we are using TIME_DIMENSION lookup..We are using below query in TIME_DIMENSION oracle stage "SELECT TIME_DIM_KEY,MONTH_OF_YEAR,YEAR FROM time_dimension where year=2008 and MONTH_OF_YEAR=11 ORDER BY
TIME_DIM_DATE" to get values of TIME_DIM_KEY,MONTH_OF_YEAR,YEAR.We need to get TIME_DIM_KEY for a source data based on YEAR,MONTH.

My doubt is as we are using ORDER BY clause which TIME_DIM_KEY we will get.Always we will get only one TIME_DIM_KEY or is there any possibility that we can get different values.I am getting different TIME_DIM_KEY values.

What's wrong in this query.Please suggest.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

There may be multiple records for the month+year combination. something like one for each day. So you may be getting different values.

What are you key links to lookup? Does the mentioned sql returns more than one row?
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What is the grain of this time dimension?

In every query engine I have ever encountered, the selection is completed before the sort is attempted. This is so that the smallest possible number of records can be sorted.
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