Error Number 1312 Mysql
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why Am I Getting MySQL Error #1312 when Using a Simple Stored Procedure? up vote 4 down vote favorite I'm trying to learn how to use MySQL stored procedures. MySQL accepted my procedure: CREATE PROCEDURE SimpleProc() BEGIN SELECT * FROM myTable; END (In phpMyAdmin, I set // for delimiter. The real version has the name of an actual table instead of myTable.). But, when I call the procedure with CALL SimpleProc();, I get error "#1312 - PROCEDURE mydb.SimpleProc can't return a result set in the given context". I read that some versions of php or phpMyAdmin won't work with stored procedures. I'm using a localhost running on a Mac with MAMP 1.9. I've got MySQL 5.1.44, PHP 5.2.13 & 5.3.2, phpMyAdmin 3.2.5. Does anyone know if stored procedures will work with my set-up? Am I doing something incorrectly? Any advice? Shout out to the Big Red for a triple overtime victory in Lax. Thanks, Laxmidi mysql stored-procedures mysql-error-1312 share|improve this question edited May 23 '11 at 5:55 OMG Ponies 199k36356415 asked May 16 '10 at 1:09 Laxmidi 1,24053266 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted Yes, there seems to be a bug in some older versions of phpMyAdmin, which can cause the 1312 error you are getting. This can happen when calling stored procedures that contain SELECT statements from phpMyAdmin. You may want to check o
Support mexiwithacan Hello, I'm trying to create a simple stored procedure as a test right now, and I cannot seem to get this stored procedure to work. The code looks as follows: Code: DELIMITER // DROP PROCEDURE IF EXISTS `select_hello` // CREATE PROCEDURE `select_hello`() BEGIN SELECT "Hello, World!"; END // DELIMITER ; All it's supposed to do is to return a result set containing one column and one row with the value "Hello, World!" in the single cell. Instead, I get http://stackoverflow.com/questions/2842263/why-am-i-getting-mysql-error-1312-when-using-a-simple-stored-procedure the following error in my offline development environment when calling the procedure from the phpMyAdmin interface: #1312 - PROCEDURE mydatabase.select_hello can't return a result set in the given context When I try the same steps in my online Frihost database, no errors are reported but I am taken back to the localhost-scoped interface (i.e., the interface shown when no database is selected). http://www.frihost.com/forums/vt-116858.html The error is documented very, very briefly in the MySQL online documentation at the following URL: http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html However, all that is said is: "For statements that can be determined only at runtime to return a result set, a PROCEDURE %s can't return a result set in the given context error occurs (ER_SP_BADSELECT)." I found this to be completely unhelpful in guiding me to the proper way to avoid this error. I would appreciate any help with getting this simple stored procedure to work. mexiwithacan Peter Brawley helped me out on the MySQL Forums here: http://forums.mysql.com/read.php?98,370074,370573#msg-370573 I tested this with the following code: Code: query('CALL select_hello'); while($row = $result->fetch_row()) { echo $row[0] . '
'; } ?> "Hello, World!" was displayed very clearly on the resulting page. I really do need to stay up-to-date with these developments in technology. Related topics Help: SQL error after uploading new files(thread updated)Email ErrorHELP!!!! My computer keeps rebooting over and over again.Forum error when postingError Posting...Fr
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for https://www.experts-exchange.com/questions/24687500/PhpMyAdmin-can't-call-stored-procedure-error-1312.html Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > PhpMyAdmin - can't call stored procedure - error 1312 Want error number to Advertise Here? Solved PhpMyAdmin - can't call stored procedure - error 1312 Posted on 2009-08-27 PHP MySQL Server 1 Verified Solution 3 Comments 4,109 Views Last Modified: 2013-12-13 I am using a stored procedure on MySQL 5.0, accessing it via PhpMyAdmin 3.2.1 The code below works beautifully using the mySQL command-line tool. But error number 1312 via phpMyAdmin, I get the error below. The SP isn't supposed to return a result set! There's no SELECT in it except into a local variable. It's supposed to check whether a column exists, assemble a DDL statement, and execute it. Like I said, it works in the mySQL command line.