[MDEV-6574] split string Created: 2014-08-13 Updated: 2022-05-27 Due: 2014-08-27 Resolved: 2014-08-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Minor |
| Reporter: | james wang | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
nice to have a function split: SELECT split("1,2,3,4,5", ','); returns: |
| Comments |
| Comment by james wang [ 2014-08-13 ] | |
|
Does this incur a lot development time please? Basically, I wish to convert a comma separated string, e.g. @str1="1,2,3,4,5", to an array @arr1 so I can use it in, e.g. SELECT uid FROM table1 WHERE id IN (@arr1); Thanks a lot in advance | |
| Comment by Sergei Golubchik [ 2014-08-13 ] | |
|
Yes, it does. But you can use FIND_IN_SET() function instead:
| |
| Comment by james wang [ 2014-08-13 ] | |
|
If it takes too much development time. please ignore this request. Used find_in_set before, it was slow. Of course, I can store @arr1 in my program and pass it to the second query as a parameter - very quick this way - but need to change code. I was just wonder if there was a simpler way. | |
| Comment by james wang [ 2014-08-13 ] | |
|
please close this ticket as I could not (even as the reporter). | |
| Comment by Tom Miller [ 2022-05-27 ] | |
|
Maybe time to reopen this? I could really use this function. SQL Server has a function STRING_SPLIT | |
| Comment by Sergei Golubchik [ 2022-05-27 ] | |
|
STRING_SPLIT in SQL Server is a table-valued function, MariaDB doesn't have table-valued functions yet. |