MySQL Forums
Forum List  »  Stored Procedures

Re: Parameters for table, field and searchValue
Posted by: Russel James
Date: October 14, 2015 04:09PM

Got it !

PROCEDURE `usp_CheckForValue`(IN p_tbl varchar(50), IN p_fld varchar(50), IN p_searchValue varchar(50))
BEGIN
SET @t = p_tbl;
SET @f = p_fld;
SET @search = p_searchValue;


SET @s = CONCAT("SELECT ", @f, " FROM ", @t, " WHERE ", @f, " = @search" );

PREPARE stmt FROM @s;

EXECUTE stmt;


END

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Parameters for table, field and searchValue
977
October 14, 2015 04:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.