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

Call procedures dynamically with table/field names

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Stored routines
    • Labels:
      None

      Description

      Hi everyone. Allow the procedures and / or functions of MariaDB to receive parameters like table name, view name, temporary table name, and / or field names, and that can be processed dynamically, for ACID operations and for declaration of cursors. For example:

      CREATE PROCEDURE procedure1
      (
      p_tableName varchar(99),
      p_fieldName varchar(99)
      )
      BEGIN
      UPDATE @p_tableName SET @p_fieldName = @p_fieldName * 10;
      INSERT INTO @p_tableName (@p_fieldName) VALUES (0);
      DELETE FROM @p_tableName where (@p_fieldName)<1;
      DECLARE myCursor CURSOR FOR SELECT @p_fieldName FROM @p_tableName;
      END;

      CALL procedure1('customers','bonus');
      CALL procedure1('customers2','extra');

      Thank yo so much.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            ceau74 ceau
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: