Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7994

Needed SQL statement which converted a delimited string into a table

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Hi!

      Sorry I couldn't select here issue type 'New Feature'.

      Here a lot of useless string functions are not clear even in some cases it is necessary for example MAKE_SET, SPACE or EXPORT_SET, but none of which are allowed to make a delimited string table.

      SELECT * FROM seq_1_to_10
      WHERE FIND_IN_SET (seq, '5,6,10')

      makes the identity thing as

      SELECT * FROM seq_1_to_10
      WHERE seq IN (1,6,10)

      the same can be obtained as

      SELECT * FROM seq_1_to_10
      WHERE seq IN (SELECT 1 UNION ALL SELECT 6 UNION ALL SELECT 10)

      If the SQL statement would be that converted a delimited string into a table as I show below would be better

      SELECT * FROM seq_1_to_10
      WHERE seq IN TABLE_STR ('5; 6; 10' ';')

      could provide a virtual table from any line

      SELECT * FROM TABLE_STR ('Aaa; zzz; xxx; bbb', ';') AS t1

      seq
      --------------
      Aaa
      zzz
      xxx
      bbb

      and continue to use it in a cursor, etc.

      SELECT
          SUBSTRING_INDEX (seq, '=', 1) as key
          SUBSTRING_INDEX (seq, '=', - 1) as value
      FROM TABLE_STR ('key1 = value1; key2 = value2; key3 = value3; key4 =', ';') AS t1

      key value
      ------ --------
      key1 value1
      key2 value2
      key3 value3
      key4

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mikhail Mikhail Gavrilov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.