So I have had no luck with Robot Framework, instead I had to write a Python solution as follows:
from robot.api.deco import keyword
import oracledb
@keyword("Execute Stored Procedure")
def execute_stored_procedure(connection_details, procedure_name, arguments_dictionary):
"""
Executes a stored procedure on an Oracle database using the provided connection details,
procedure name, and arguments dictionary.
Args:
connection_details (dict): A dictionary containing connection details for the Oracle database.
Requires the following keys: 'dbUser', 'dbPassword', 'dbHost', 'dbPort', 'dbServiceName'.
procedure_name (str): The name of the stored procedure to execute.
arguments_dictionary (dict): A dictionary containing the arguments to pass to the stored procedure.
Returns:
None: This function does not return any value.
Raises:
oracledb.Error: If any error occurs during the execution of the stored procedure,
an oracledb.Error is raised.
Example:
| ${connection_details}= | Create Dictionary | dbUser | my_user | dbPassword | my_password | dbHost | localhost | dbPort | 1521 | dbServiceName | my_service |
| ${arguments}= | Create Dictionary | arg1 | value1 | arg2 | value2 |
| Execute Stored Procedure | ${connection_details} | my_stored_procedure | ${arguments} |
"""
# Construct the connection string
connection_string = f"{connection_details['dbUser']}/{connection_details['dbPassword']}@{connection_details['dbHost']}:{connection_details['dbPort']}/{connection_details['dbServiceName']}"
# Connect to the Oracle database
connection = oracledb.connect(connection_string)
try:
# Create a cursor
cursor = connection.cursor()
# Call the stored procedure with the provided name and arguments
cursor.callproc(procedure_name, keywordParameters=arguments_dictionary)
# Commit the transaction
connection.commit()
# Close the cursor
cursor.close()
except oracledb.Error as error:
print("Error occurred:", error)
# Rollback the transaction in case of error
connection.rollback()
finally:
# Close the connection
connection.close()