Replace function with hash file value

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
bunu1977
Participant
Posts: 35
Joined: Thu Oct 16, 2003 4:46 am

Replace function with hash file value

Post by bunu1977 »

Hi,
I am extracting data from oracle and while extracting data I am using an user defined sql statement. This user defined sql statement contains one function which will generate a date value.

I am using the user defined sql which looks like

select .....
from .....
where column1 = fungetvalue(parameter)
and column2 =....;

As the same function I am using in multiple jobs, I want to create a job and write the output value of the function to some temp hash file and use the value in all the other jobs. This will improve the performance.

How can I read the value of the hash file in the source Oracle OCI satge?
Dilip Das
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

You cannot read a value from a hashed file using an OCI stage if that is what your question is about.

Of course, the first time you can write the value generated by the function into a hashed file and use this hashed file as a look-up.

Your question is framed very poorly. Please frame your properly to get better answers. It helps you and also everybody.

Thanks,
Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Replace function with hash file value

Post by gateleys »

If you are using a user-defined SQL in the OCI stage and passing the result to a hashed file, you already have the data available. Now, make use of this data....may be via a lookup, as Naveen suggested, in other jobs. Or, may be I did not understand your question!!

gateleys
bunu1977
Participant
Posts: 35
Joined: Thu Oct 16, 2003 4:46 am

Re: Replace function with hash file value

Post by bunu1977 »

Hi,
I know that I cant read hash file using oracle oci stage.
I think my question is not clear.

Dastastage works row by row. So if I use one function in a sql query, then this function will execute once for each row. To avoid that I need to execute the function and store the value somewhere (I cant create any temp table and store the date) and in my datastage job, i want to use the value instead of the function. But I want to use it in source stage(i am using oracle oci stage).
Can I do this.
Dilip Das
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Hi

What you can do is have a job which runs the function and writes it to hashed file or sequential file. In your Oracle job create a new parameter which will be used in place of the function. Before running your Oracle job read the hashed or sequential file which has the value and pass it to the Oracle job parameter.

There is no way inside your Oracle job where you can execute the function and use that value inside your SQL query.
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
bunu1977
Participant
Posts: 35
Joined: Thu Oct 16, 2003 4:46 am

Post by bunu1977 »

Hi Siva,
Thanks for this suggestion. If my function return some alphanumeric characters then I can do this.

But in this scnario the function returns a date value and if I need to use the date value in the where clause then I need to use to_date function.
for example
select..............where
to_date(#parmPMDate#,'YYYYMMDD') =col_value

and I dont want to use to_date here because it will slow my process.
I have tried to run this without using to_date and the job aborted with error. But if I use to_date then my job is completing successfully.
Dilip Das
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

bunu1977 wrote:and I dont want to use to_date here because it will slow my process.
What makes you think that? It won't.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bunu1977
Participant
Posts: 35
Joined: Thu Oct 16, 2003 4:46 am

Post by bunu1977 »

Thanks a lot
Dilip Das
Post Reply