0

I am trying to return multiple resultsets from (phpmyadmin) mariadb procedure but am failing. For example I have two tables Entities and Relations and for a test I created a procedure to select everything from both tables:

DROP PROCEDURE IF EXISTS TEST_FOO;

DELIMITER &&

CREATE PROCEDURE TEST_FOO()
BEGIN
    SELECT * FROM Entities;
    SELECT * FROM Relations;
END &&
DELIMITER ;

CALL TEST_FOO();

When I run this query I get an error:

Error

Static analysis:

1 errors were found during analysis.

Missing expression. (near "ON" at position 25)

SQL query: Copy Edit Edit

SET FOREIGN_KEY_CHECKS = ON;

MySQL said: Documentation #2014 - Commands out of sync; you can't run this command now

What am I missing? It says something about foreign key checks and in phpmyadmin there is a checkbox with the same name and it doesnt matter if I check it or not.

6
  • procedures have no resultset, can't you join both tables that would work
    – nbk
    Feb 22 at 23:20
  • @nbk These tables have different columns and different number of them. I've read that you can select multiple tables in mysql so I assumed it is also possible somehow with mariadb. Feb 22 at 23:25
  • a join combines two tables , by putting them horizontally together, s taht yoiu become one large table as result set
    – nbk
    Feb 22 at 23:32
  • yes but php has nothing to do with sql, so while php or python works, it doesn't mean that it will work in sql
    – nbk
    Feb 22 at 23:38

1 Answer 1

0

This looks like a problem with phpmyadmin.

Your procedure works fine, as far as I can tell, when running it in the mariadb command-line client. So the workaround is to not use phpmyadmin for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.