To call a stored procedure from a Python application, use ibm_db.callproc function. The procedure that you call can include input parameters (IN), output parameters (OUT), and input and output parameters (INOUT).
Obtain a connection resource by calling one of the connection functions in the ibm_db API.
To call a stored procedure with the ibm_db.callproc function:
import ibm_db
conn = ibm_db.connect("sample", "username", "password")
if conn:
name = "Peaches"
second_name = "Rickety Ride"
weight = 0
print "Values of bound parameters _before_ CALL:"
print " 1: %s 2: %s 3: %d\n" % (name, second_name, weight)
stmt, name, second_name, weight = ibm_db.callproc(conn, 'match_animal', (name, second_name, weight))
if stmt is not None:
print "Values of bound parameters _after_ CALL:"
print " 1: %s 2: %s 3: %d\n" % (name, second_name, weight)