MySQL Forums
Forum List  »  Connector/Python

Getting the output parameter after calling a stored procedure!
Posted by: Ernest Bonat
Date: March 11, 2014 12:51PM

1. I did follow the example shown in the developer guide (page 45) as:

stored procedure:

CREATE PROCEDURE multiply(IN pFac1 INT, IN pFac2 INT, OUT pProd INT)
BEGIN
SET pProd := pFac1 * pFac2;
END

python code:

procedure_name = 'multiply'
arguments = (5, 5, 0)
cursor = mysql_connect.cursor()
cursor.callproc(procedure_name, arguments)
print(arguments)

and printing of the arguments list does not show me output parameter pPro. I got the same entry as:
(5, 5, 0)

How did you get the value ('5', '5', 25L)?

2. Same situation with a string as output parameter:

stored procedure:

CREATE PROCEDURE magazine.`string_concatenation`(IN pA varchar(50), IN pB varchar(50), OUT pC varchar(50))
BEGIN
SET pC = CONCAT(pA, pB);
END;

python code:

procedure_name = 'string_concatenation'
arguments = ('A', 'B', '')
cursor = mysql_connect.cursor()
cursor.callproc(procedure_name, arguments)
print(arguments)

This code will print: ('A', 'B', '')

How do I show the value of pC in python code?

Options: ReplyQuote


Subject
Written By
Posted
Getting the output parameter after calling a stored procedure!
March 11, 2014 12:51PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.