How to get value of Out Parameter of execute Query

I have a store Procedure and its has 1 output parameter,
I want to access that value.
Please guide.

1 Like

I don’t think this is possible now.

I see that in UiPath.Database.Activities ExecuteQuery returns a datatable object.

Therefore the only solution is to rewrite your stored procedure so that it selects your output param.

1 Like

Thank you Badita.:slight_smile:

Hi, So what does the parameter (direction) Out is used to?
I am trying to achieve the same thing but cannot think that they build a parameter Out just to confuse people, and I want to have a dataTable and my Parameter in the Output of the activiy.

Hello, So I find my way to this, and Yes if the parameter is set to Out, you can Declare your parameter in your StoredProcedure with the attribute “out” and it will be available in UIPath :
@myOutPut int out
SET @myOutPut = 2

Then in UiPath you can call the storedProcedure with :
parameter : myOutPut
direction : out
value : myVar


Does someone actually tried this? I’m trying with the same steps that @nbouscarat said and I’m getting no value.

Hi @pablobalto, may it can help you :
@input bit,
@output bit out
SET @output =@input

If you try this store proc it will return inside the output parameter, what you give in input one.
Then in Uipath :

Hi @nbouscarat, I already tried that and didn’t work. I don’t know if there’s something about the database connection. I’m using ORACLE.

Hi I tried this method to get a value after SQL insert. But it always return 0.

Insert into [dbo].[Tbl_MappingDetail](Customer_EntityID,BusinessMessage_Uid,MessageFormat_Uid,Version_Uid,OriginType,FlowType,OriginSystem,Destinationtype,DestinationSystem,
Originformat,Destinationformat)Values(@Customer_EntityID,@BusinessMessage_Uid,@MessageFormat_Uid,@Version_Uid,(SELECT x.i.value(‘./SourceType[1]’,‘Varchar(100)’)FROM
@x.nodes(‘/form1/main/Body’) as x(i)),(SELECT x.i.value(‘./Messageflow[1]’,‘Varchar(100)’)FROM
@x.nodes(‘/form1/main/Body’) as x(i)),(SELECT x.i.value(‘./SourceName[1]’,‘Varchar(100)’)FROM
@x.nodes(‘/form1/main/Body’) as x(i)),(SELECT x.i.value(‘./TargetType[1]’,‘Varchar(100)’)FROM
@x.nodes(‘/form1/main/Body’) as x(i)),(SELECT x.i.value(‘./TargetName[1]’,‘Varchar(100)’)FROM
@x.nodes(‘/form1/main/Body’) as x(i)),(SELECT x.i.value(‘./SourceMessageFormat[1]’,‘Varchar(100)’)FROM
@x.nodes(‘/form1/main/Body’) as x(i)),(SELECT x.i.value(‘./TargetMessageformat[1]’,‘Varchar(100)’)FROM
@x.nodes(‘/form1/main/Body’) as x(i)))

Set @Mapping_id =@@IDENTITY

select @Mapping_id
Could see correct value populated in SQL result

If you do a Select @Mapping_id, your result will be in the datatable “Result” I think. You need to init your @Mapping_id as an Out parameter inside your StoreProc.



In my scenario existing SP return multiple DT.

When i call the SP using execute Query activity only the first DT in the returned in output result. How i can store the required DT in the result?

@Rajasegar94 You are right. For now we don’t have a solution to this other then rewriting the query or executing multiple queries.

1 Like

@Badita, Thanks for the response. I will look to change the SP.
Can we except in upcoming version for SQL querying activity which stores the result as Dataset instead of DT to have a solution to this issue.

Hi @nbouscarat - I tried your method word by word, but still I couldn’t get the value in Output Parameter. I am using UiPath 2018.2 Community Edition.

You can manage to return only 1 datatable from your query :
SELECT problem, Solution, Keyword, Category FROM ([JOINED QUERY DISPLAYING YOUR RESULT])

Or you can put each result into an out variable from your activities. But Seems to not work anymore

Yep, you are right, I updated to the last version and don’t seems to work anymore…