This method calls a stored procedure with the given name. The
args sequence of parameters must contain one
entry for each argument that the routine expects. The result is
returned as modified copy of the input sequence. Input
parameters are left untouched, output and input/output
parameters replaced with possibly new values.
Result set provided by the stored procedure are automatically fetched and stored as MySQLBufferedCursor instances. For more information, see stored_results().
The following example shows how to execute a stored procedure which takes two parameters, multiplies the values and returns the product:
# Definition of the multiply stored procedure:
# CREATE PROCEDURE multiply(IN pFac1 INT, IN pFac2 INT, OUT pProd INT)
# BEGIN
# SET pProd := pFac1 * pFac2;
# END
>>> args = (5, 5, 0) # 0 is to hold value of the OUT parameter pProd
>>> cursor.callproc('multiply', args)
('5', '5', 25L)

User Comments
Add your own comment.