At last I found the solution, I'll put it here so that no one will get stuck in this thing again...
CREATE PROCEDURE getCount (IN tbl varchar(50))
BEGIN
SELECT CONCAT(CONCAT(CONCAT("SELECT COUNT(*) AS ", tbl)," FROM "), tbl)INTO @query;
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE...
hi. i'm writing a procedure that retrives row count of any table (in a specific dataase). table name should be supplied as a parameter to the procedure.
i wrote:
--++++++++++++++++++++++++++++++++++++++++++++++++++++++
DROP PROCEDURE IF EXISTS getCount;
CREATE PROCEDURE getCount(IN tableName...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.