Executing Oracle Stored Procedure after load.

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
sambit
Participant
Posts: 52
Joined: Mon Sep 05, 2005 4:59 am

Executing Oracle Stored Procedure after load.

Post by sambit »

Hi,
I want to execute a stored procedure as soon as I load the data in a table thru Oracle Enterprise Stage thru Load-Append method. I tried using the close command and after sub-routine options also. None of them is working. I tried using EXEC and CALL options in Close command.

Any help on this is appreciated.
Thanks !!!
Sambit
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"Not working" is unhelpful to us, because you have not described precisely what you tried. It's one thing to say you used EXEC, but how can we know that you used EXEC correctly?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
betterthanever
Participant
Posts: 152
Joined: Tue Jan 13, 2009 8:59 am

Re: Executing Oracle Stored Procedure after load.

Post by betterthanever »

[quote="sambit"]Hi,
I want to execute a stored procedure as soon as I load the data in a table thru Oracle Enterprise Stage thru Load-Append method. I tried using the close command and after sub-routine options also. None of them is working. I tried using EXEC and CALL options in Close command.

Any help on this is appreciated.[/quote]

did you try this
in the "CLOSE COMMAND"

BEGIN
EXEC STORED PROCEDURE
END;
sambit
Participant
Posts: 52
Joined: Mon Sep 05, 2005 4:59 am

Post by sambit »

Yeah. I tried the following,


begin schema.stored_procedure_name(parameter); end;

Error- Fatal Error: Invalid close command
Thanks !!!
Sambit
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The stored procedure must exist in the database. You can not create stored procedure code in the CLOSE command. You invoke the stored procedure from the CLOSE command (or from a Stored Procedure stage or wherever).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mk_ds09
Participant
Posts: 72
Joined: Sun Jan 25, 2009 4:50 pm
Location: Pune

Post by mk_ds09 »

One of the options I can suggest is that you can put trigger on your table which is going to load..
And that trigger in turn can call the procedure. You can have trigger at trancation level or as row level.

However the limitation with this apporach is that you can not have commit statements in the trigger you are using ! you can use only the DML statments.

hope this helps

----------------------------------

MK
betterthanever
Participant
Posts: 152
Joined: Tue Jan 13, 2009 8:59 am

Post by betterthanever »

[quote="sambit"]Yeah. I tried the following,


begin schema.stored_procedure_name(parameter); end;

Error- Fatal Error: Invalid close command[/quote]

try
begin
exec stored procedure
end;
sambit
Participant
Posts: 52
Joined: Mon Sep 05, 2005 4:59 am

Post by sambit »

Thanks for your help. The command which I mentioned in the last post is successfully executing now. There was an access issue for that.

I was wondering if anyone can help me in executing the same command thru a Command Activity Stage thru sequencer.

Command:
Parameters:

What do I put in above 2 cols? The commands and the parameters that I am trying execute and use are -

Command: begin schema.stored_procedure_name(parameter1); end;
Parameter: DB server name,DB user id, DB user pwd, schema name, parameter1
Thanks !!!
Sambit
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

executing the same command thru a Command Activity Stage thru sequencer.
Try

Code: Select all

sh -c
with argument

Code: Select all

echo "EXEC STORED PROCEDURE" | sqlplus -s dbUser/'dbPwd'@dbDSN
Assuming unix and the oracle bin path is in your $PATH when you run teh job sequencer
Post Reply