Is it possible to call MySQL stored functions (i.e. functions rather than procedures)?
Thanks,
Aha -- that's it. Use cursor.execute("select myFunction()"). If you use cursor.callproc("myFunction") you get:
(1305, 'PROCEDURE testdb1.myFunction does not exist')
Yep, callproc() is only for stored procedures.
A stored function works like a regular function, so yes, and you don't need to do anything special.
Side note: You don't have to use cursor.callproc() to call stored procedures. You can use cursor.execute() if you prefer.
Log in to post a comment.
Is it possible to call MySQL stored functions (i.e. functions rather than procedures)?
Thanks,
Aha -- that's it. Use cursor.execute("select myFunction()").
If you use cursor.callproc("myFunction") you get:
(1305, 'PROCEDURE testdb1.myFunction does not exist')
Yep, callproc() is only for stored procedures.
A stored function works like a regular function, so yes, and you don't need to do anything special.
Side note: You don't have to use cursor.callproc() to call stored procedures. You can use cursor.execute() if you prefer.