Calling Function From STP stage

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
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

Calling Function From STP stage

Post by pradkumar »

Hi

I would like to call a function which is in Oracle.
I know one way of doing it (Call it as select in OCI stage)
But the function which I am having does not execute with SELECT stmt and gives it error num as "1".
But when I execute this function normally, it is doing good.

So Now I decided to call it as a procedure using STP stage.
How to accomplish this?

Thanks
Pradeep
Pradeep Kumar
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Create a stored procedure and import in the Stored Procedure stage and call it. Else you can call using OCI stage as well. {call sp(input,output)};
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Call to the stored procedure can be made in the before/after sql tab.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A function is not the same things as a stored procedure.

The only way you have to use a Stored Procedure stage to invoke a function is to create a stored procedure which in turn calls the function. Unnecessary overhead.

Your time would be better spent diagnosing why the function does not seem to work in a SELECT statement, which is where it is intended to be used. What other warning messages are logged?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

Post by pradkumar »

Thx all


Actually my Oracle team will develop functions and give it to me to implement the job calling the func/proc.
I tried executing the SQL code in TOAD too with SELECT stmt.
It is supposed to give errornum = 0 if it gets executed succesfully. But it is giving 1. So I figured out that it is not the problem of DS.

But those people wants me to call the function without using "SELECT" stmts.

This is where I was stucked.
Pradeep Kumar
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

So stored procedure which calls the function will be the preffered approach.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't "call the function" without using a SELECT statement - that's how they work, they must be selected. :?

And wrapping the select of the function into a stored procedure just seems... silly. But hey, if that's what your Oracle team wants you to do, knock yourself out. :roll:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply