MySQL Forums
Forum List  »  Stored Procedures

Wrap MATCH() AGAINST() to single function
Posted by: Joel Hervén
Date: June 08, 2014 03:06PM

Due to limitations in my ORM I was trying to wrap the MATCH() AGAINST() call into one function. Lets say my column name is "Word" instead of calling MATCH(Word) AGAINST('input') I would be able to call something like MatchWord('input').

I wrote this function:

DELIMITER $$

CREATE DEFINER=`root`@`localhost` FUNCTION `NameMatch`(matchName VARCHAR(45)) RETURNS double
BEGIN
RETURN MATCH(Word) AGAINST(matchName);
END

This results in, Error Code: 1054. Unknown column 'Word' in 'field list'

Is it possible to reference a column in a stored function like this?

Options: ReplyQuote


Subject
Views
Written By
Posted
Wrap MATCH() AGAINST() to single function
1674
June 08, 2014 03:06PM


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.