From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

execute a stored procedure on a database

Hi,

I want to execute a stored procedure on an oracle database. Therefore I use the open SQL step configured as follows:
- option "statement requires parameters" is checked
- on the advanced tab: Command Type = Stored Procedure

After this step I use the Data Operation step with operation = Execute. Now, how can I set values for the parameters?

Has anyone an example where I can see how the needed steps have to be configured?

Thanks in advance
Best regards
Steffen
0 Kudos
Message 1 of 4
(3,207 Views)
hi Steffen,

perhaps this helps.
if I understand right this shows how to set a parametre with "statement".
hope this helps.

greets!
0 Kudos
Message 2 of 4
(3,171 Views)
Hi Steffen,

Your sequence should have the following steps:

1) Open Database
2) Open SQL Statement
3) Data Operation
4) Close SQL Statement
5) Close Database

I am using a very basic stored procedure that doesn't really do anything:
CREATE PROCEDURE MySP @myInput int AS SELECT * FROM myTable GO

For step 2, your SQL Statement field should be the name of the stored procedure. In my example, it would simply by "MySP". Make sure you have the "Statement has parameters" field is checked.

For step 3, select "Execute" as the Operation. Under the Column/Parameter field, you can insert all of your parameters. In my case, I just have one parameter. I can refer to it by index (1) or name ("myInput").

Hope this helps!

Allen P.
NI
0 Kudos
Message 3 of 4
(3,148 Views)
Hi Allen,

thanks for your answer! I've already been quite right, the only thing that was wrong was that I declared the SQL Statement in the Open SQL Statement step including the parameters e.g. "MySP(Param_1,Param_2)" - with only "MySP" everything works fine!

Regards
Steffen
0 Kudos
Message 4 of 4
(3,125 Views)