How to call sql store procedure with parameters in uipath

“OZRisk360.dbo.spRiskAdd Risk = '”+RiskJSON+“', BusinessAdressID= '”+AddressID+"’ "

i am adding json into sql

@iamhamzanasir

In the query field you would only give the stored procedure name…in the properties you will see parameters option…that is where you can pass the parameters you need in stored proc…please try the same

Cheers

Hi,

Can you please provide a full, working example on how to do that? Because I’ve tried all combinations on none is working.

@pere

Try this

Cheers

Hi,

I tried that also prior to my comment and it fails. Note that, in my case, I don’t have any parameters to pass to the stored procedure, so it shouldn’t be even easier.

Plus I just replied a few second ago the guy who wrote the answer because he’s doing unnecessary, confusing and more error-prone escaping and concatenation in his example, while it should work merely like this:

"exec YourStoredProcedure @YourRequiredParameter='"+inputAccountNumber+"'"

My “Commnand type” is set to “Text” in the Run query activity.

@pere

If it a only a stored proc…just giving name should be enough are you getting any error?

Cheers

SQL command (String):

"AUX.GENERAR_FICHEROS"

Command type:

StoredProcedure

Error:

Run command: ERROR [42000] [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement

Activity “Run command” (former “Execute Non Query”):

The same.

@pere

You should be using run query…I believe you are using run command

Cheers

I tried a combination of whatever other ways to call the stored procedure, each of them throwing a different error. I can paste the outcome in case anyone is interested.

I wonder why the heck they still keep this “Run command” activity that, furthermore, to add even more confusion, it was renamed from “Execute Non Query” (and it’s still referenced as that in the docs, Activities - Execute Non Query (uipath.com), and in the properties it’s still called UiPath.Database.Activities.ExecuteNonQuery as well, and every reference in the forum is to “Execute non query”). If they changed the “Run query” activity to allow changing the “Command type” parameter so you could, theoretically, call stored procedures and/or run PL/SQL code, there should be no need for the other old activity.

I said “theoretically” because, of course, I’ve found no way to do so agains an ORACLE database.

I already said in the comment you were replying to that I tried with both activities (out of desperation). And, in my last comment, I’m ranting about why they keep both (and, furthermore, change the name of the “legacy” one, adding more confusion) if, theorically, there’s no need for it anymore.

@pere

Run command is for insert ,delete etc……for select queries and stored procs run query is used…

In the second one try to include the stored proc inbetween square brackets and check…also open advanced editor and key in the value…try with only name or full qualified name

Cheers

Thank for your effort, @Anil_G ,

These are some of the combinations I tried:

"{ AUX.GENERAR_FICHEROS }"
Run query: ERROR [42000] [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement
"EXECUTE AUX.GENERAR_FICHEROS"
Command type: StoredProcedure
Run query: ERROR [42000] [Oracle][ODBC]Syntax error or access violation.
"EXECUTE AUX.GENERAR_FICHEROS();"
Command type: StoredProcedure
Run query: ERROR [42000] [Oracle][ODBC]Syntax error or access violation.
"CALL AUX.GENERAR_FICHEROS();"
Run query: ERROR [HY000] [Oracle][ODBC][Ora]ORA-06576: not a valid function or procedure name
"call AUX.GENERAR_FICHEROS;"
Run query: ERROR [HY000] [Oracle][ODBC][Ora]ORA-06576: not a valid function or procedure name

"{ call AUX.GENERAR_FICHEROS(); }"

"{ call AUX.GENERAR_FICHEROS; }"
Run query: ERROR [42000] [Oracle][ODBC]Syntax error or access violation.

"{ call AUX.GENERAR_FICHEROS() };"

"{ call AUX.GENERAR_FICHEROS};"

Run query: ERROR [HY000] [Oracle][ODBC][Ora]ORA-06564: object AUX.GENERAR_FICHEROS does not exist
ORA-06512: at "SYS.DBMS_DESCRIBE", line 126
ORA-06512: at "SYS.DBMS_UTILITY", line 156
ORA-06512: at "SYS.DBMS_DESCRIBE", line 122
ORA-06512: at line 1
"{ call AUX.GENERAR_FICHEROS() }"

Run query: ERROR [HY000] [Oracle][ODBC][Ora]ORA-06564: object AUX.GENERAR_FICHEROS does not exist
ORA-06512: at "SYS.DBMS_DESCRIBE", line 126
ORA-06512: at "SYS.DBMS_UTILITY", line 156
ORA-06512: at "SYS.DBMS_DESCRIBE", line 122
ORA-06512: at line 1

@pere

Please try these…Use Run Query, Open advanced editor and give the value

"EXEC AUX.GENERAR_FICHEROS"

"EXEC [AUX].[GENERAR_FICHEROS]"

"EXEC GENERAR_FICHEROS"

"EXEC [GENERAR_FICHEROS]"

"AUX.GENERAR_FICHEROS"

"[AUX].[GENERAR_FICHEROS]"

I do not have a DB right now with me…If I remember correctly either last or the first worked for us

cheers

"EXEC AUX.GENERAR_FICHEROS"
Run query: ERROR [42000] [Oracle][ODBC]Syntax error or access violation.
"EXEC [AUX].[GENERAR_FICHEROS]"
Run query: ERROR [42000] [Oracle][ODBC]Syntax error or access violation.
"EXEC GENERAR_FICHEROS"
Run query: ERROR [42000] [Oracle][ODBC]Syntax error or access violation.
"EXEC [GENERAR_FICHEROS]"
Run query: ERROR [42000] [Oracle][ODBC]Syntax error or access violation.
"AUX.GENERAR_FICHEROS"
Run query: ERROR [42000] [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement
"[AUX].[GENERAR_FICHEROS]"
Run query: ERROR [42000] [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement

@pere

Can you show the detailed exception from locals pane if that is different…and let me get back to you…I ll try to setup a db and check and give you the details

Cheers

Not any special info in the exception details that I can see:

Note this is for

"AUX.GENERAR_FICHEROS"

Many thanks for your effort, Anil.

1 Like