Re: Parameters for table, field and searchValue
OK, I think I'm almost there....
Here is my sproc.
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
I am looking up a table called "species" and a field called "speciesID" and looking for "COD"
CALL usp_SearchForValue("Species", "SpeciesID", "COD")
I get error message:
Error Code: 1054. Unknown column 'COD' in 'where clause' 0.000 sec
It's too literal this time !!
Can you advise ?
Thanks.
Subject
Views
Written By
Posted
2520
October 13, 2015 04:53PM
923
October 13, 2015 11:57PM
Re: Parameters for table, field and searchValue
1039
October 14, 2015 02:45PM
1091
October 14, 2015 04:09PM
851
October 24, 2015 10:50PM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
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.