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

SQL block under EXECUTE IMMEDIATE

    XMLWordPrintable

Details

    Description

      Unlike Oracle, in MariaDB there's no possibility to use dynamic SQL (EXECUTE IMMEDIATE) for block of SQL statements (PL/SQL block), encapsulated in varchar string. Just a single DML statement a time. This raises some inconvenience for us in our current task to check option to port our solution to MariaDB.
      Then we've checked the idea to create temporary procedure for such purpose, to execute a serie of statements (with loop, if-then constructs inside). But this failed as well, because this temporary procedure should be created on-fly from some other procedure, running on timely event, and you cannot issue

      execute immediate 'create procedure...';

      from within procedure.
      Another option I've found in stackoverflow post, it offers creating procedure by INSERT INTO `mysql`.`proc` ... and then issue execute immediate 'call ...', but this seems to me quite wild.
      Is there some other option to execute dynamically formed SQL block as single EXECUTE IMMEDIATE call?

      Attachments

        Activity

          People

            Unassigned Unassigned
            balta Tadas Balaišis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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