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

Make "for" sentence support JSON arrays

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Fix Version/s: N/A
    • Component/s: JSON
    • Labels:
      None

      Description

      Hello.

      Is it possible to make "for" sentece support JSON arrays? For example:

      declare json_string varchar(1024) default '[
          {"rdbms":"MySQL/MariaDB","tag":"Rocks!"},
          {"rdbms":"Oracle Database","tag":"It\'s fine"},
          {"rdbms":"IBM DB2","tag":"Available in z/OS"},
          {"rdbms":"Microsoft SQL Server","tag":"No comments"}
      ]';
       
      for rdbms in json_query(json_string, '$') do
         -- Do something with current iteration's object.
         select json_value(rdbms, '$.rdbms'), json_value(rdbms, '$.tag');
      end for;
      
      

      Regards.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              null_pointer_00 Rubén
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: