View with parameter IN I'm creating a view in which I have a where with an in clause and I want it to be a parameter. Unfortunately views can't be created with parameters, so I tried replacing it with functions, but functions only return a string.

Is there a way to create a view that accepts multiple options? example:

SELECT name, surname from people WHERE name in (@names)


I'm using MySQL 5.5
oNare's answer shows the principle way to achieve this. (He gets a +1 !!!)
He set the variable @names as follows:
SET @names=&quot;'oNare','Another'&quot;;

Then, his algorithm worked perfectly.
SUGGESTION
Instead of putting single quotes in @names, do it without the single quotes.
Do the delimiting before processing the query with this
SET @names='oNare,Another';
SET @names=CONCAT('''',REPLACE(REPLACE(@names,'''',''''''),',',''','''),'''');

What does @names look like now ???
mysql&gt; SELECT @names;
+-------------------+
| @names            |
+-------------------+
| 'oNare','Another' |
+-------------------+
1 row in set (0.00 sec)

mysql&gt;

I loaded his sample data and tried it out
mysql&gt; SET @names='oNare,Another';
Query OK, 0 rows affected (0.00 sec)

mysql&gt; SET @names=CONCAT('''',REPLACE(REPLACE(@namelist,'''',''''''),',',''','''),'''');
Query OK, 0 rows affected (0.00 sec)

mysql&gt; SELECT @names;
+-------------------+
| @names            |
+-------------------+
| 'oNare','Another' |
+-------------------+
1 row in set (0.01 sec)

mysql&gt; SET @query=CONCAT(&quot;SELECT
    &quot;&gt;                             fName,
    &quot;&gt;                             lName
    &quot;&gt;                         FROM user
    &quot;&gt;                         WHERE fName IN (&quot;,@names,&quot;)&quot;);
Query OK, 0 rows affected (0.00 sec)

mysql&gt; PREPARE stmt FROM @query;
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql&gt; EXECUTE stmt;
+---------+-------+
| fName   | lName |
+---------+-------+
| oNare   | Test  |
| Another | Test  |
+---------+-------+
2 rows in set (0.00 sec)

mysql&gt; DEALLOCATE PREPARE stmt;
Query OK, 0 rows affected (0.00 sec)