Hi Fabio,
I do not speak your language, so I tried to convert SQL based on your samples :)
SELECT INSTR('1,2,3',',',1,2) FROM CONTENIDO;
->
SELECT LOCATE(',', '1,2,3', LOCATE(',', '1,2,3')+1) FROM CONTENIDO;
The first locate() will return the first occurrence, the second locate() will return the second occurrence.
mysql> create table t2 (c1 varchar(100));
Query OK, 0 rows affected (0.26 sec)
mysql> insert into t2 values ('1,2,3');
Query OK, 1 row affected (0.07 sec)
mysql> SELECT LOCATE(',', '1,2,3', LOCATE(',', '1,2,3')+1) FROM t2;
+----------------------------------------------+
| LOCATE(',', '1,2,3', LOCATE(',', '1,2,3')+1) |
+----------------------------------------------+
| 4 |
+----------------------------------------------+
1 row in set (0.14 sec)
It is more complicated if you need to find 7th occurrence :)
Kind regards, Dmitry Tolpeko
--
SQLWays - Convert Oracle PL/SQL stored procedures, packages, triggers and queries to MySQL
http://www.ispirer.com/products/mysql-migration