MySQL Forums
Forum List  »  Stored Procedures

Parameters for table, field and searchValue
Posted by: Russel James
Date: October 13, 2015 04:53PM

Hi Folks,

Im trying to create a sproc that will return 1 or 0 if a searchValue is found within a specified field within a specified table.

Something like...

CREATE DEFINER=`root`@`localhost` PROCEDURE `usp_CheckIfValueExists`(IN p_tbl varchar(50), IN p_fld varchar(50), IN p_searchValue varchar(50))

SELECT EXISTS(SELECT 1 FROM p_tbl WHERE p_fld = p_searchValue);


But it just not working.

Can I not use parameters on the left side of a Where clause ??


Options: ReplyQuote

Written By
Parameters for table, field and searchValue
October 13, 2015 04:53PM

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.