MySQL - explode/split input to stored procedure

前端 未结 3 1252
臣服心动
臣服心动 2021-01-23 08:02

I have problem, I need to explode my input to my stored procedure, but don\'t know how I can do it.

My stored procedure has a VARCHAR(256) input which I need to split an

相关标签:
3条回答
  • 2021-01-23 08:11

    Here is a split_string() function http://forge.mysql.com/tools/tool.php?id=4

    0 讨论(0)
  • 2021-01-23 08:13

    Try my SQL Library: http://ondra.zizka.cz/stranky/programovani/sql/mysql_stored_procedures.texy

    0 讨论(0)
  • 2021-01-23 08:28

    Yes, please see this forum thread on replicating the functionality in mysql that tsql provides.

    That thread also discusses some of the downfalls of this method. Also, I think you want to be using VARCHAR(255) or just VARCHAR(MAX) because there is no benefit to a 256, it uses a 2 byte size prefix and yet only stores 256 characters.

    Have you considered using xml and xpath syntax to extract the values instead? I think going forward this will become a more readable and maintainable method.

    0 讨论(0)
提交回复
热议问题