Stored functions and prepared statements
Posted by: Daniel Keyhani
Date: January 24, 2011 11:50AM

Hello all,

after a lot of frustration and testing, I have concluded that it's apparently impossible to call a stored function from a prepared statement, no matter how simple the function (e.g. a simple test function that returns its single integer parameter). The statement is prepared, calling mysql_stmt_execute() on it seems to work fine, but according to the server log it is never executed, and no result is returned.

By the way, I'm using MySQL 5.1.50. I read that "Before MySQL 5.1.4, CALL statements cannot be prepared, meaning that stored procedures cannot be called from dynamic SQL. This is true both for server-side prepared statements and for SQL prepared statements", but a) there's no mention of stored functions, b) 5.1.50 > 5.1.4, right?

So I'm thinking that this *should* work, however I'm stuck with it not working. Can anyone offer any advice? Oh yes, main reason I'm using prepared statements is that I'm inserting random binary data.

Options: ReplyQuote

Written By
Stored functions and prepared statements
January 24, 2011 11:50AM

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.