Scenario: I have a table in a mariaDB. It’s called “pages”. It just has three columns and a few entries for test purposes.
Problem: I try to create a nice PREPARE statement in SQL. I did not get it working so I ended up with the following ‘simple’ code.
PREPARE stmt from 'SELECT * FROM `pages`;';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
It does kind of execute without errors, but it does not show a single row.
What am I missing here?
If you are asking, why I use a prepare statement for such a simple query: It is just for finding the error. The final query will be more complicated with variables etc.
Thanks in advance!
P.S.: Could be a double of Select * for mysql prepare statement not listing anything but maybe not.
Additional Info I run the code as a direct SQL Query in Sequel Pro.
RIGHT ANSWER
Joakim Danielson had the right guess.
prepare stmt from 'SELECT * FROM `pages`;'; execute stmt;
DEALLOCATE PREPARE stmt;
This works in Sequel Pro. BUT I totally recommend to not use Sequel Pros command line. Other bugs occurred one after another. Not so in the mysql CLI. Better go with your OS’ command line.