Hi
I want a function which should return the max value of int column. Parameter TableName should be passed to the function.
Thanks
Hi
I want a function which should return the max value of int column. Parameter TableName should be passed to the function.
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jithu ThomasRank #437 · 5.7K reputationPosted Sep 1, 2024, 1:14 PM EDT
CREATE PROCEDURE GetMaxValue(IN tableName VARCHAR(255), IN columnName VARCHAR(255)) BEGIN SET @query = CONCAT('SELECT MAX(', columnName, ') AS max_value FROM ', tableName); PREPARE stmt FROM @query; EXECUTE stmt; DEALLOCATE PREPARE stmt; END