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

Implement INSERT INTO <TABLE> VALUES <VALUES> RETURNING <FIELDS> INTO <HOST_VARIABLES>

    XMLWordPrintable

Details

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

    Description

      Hi

      Is it possible to implement Oracle's syntax for

      INSERT INTO <TABLE> VALUES <VALUES> RETURNING <FIELDS> INTO <HOST_VARIABLES>

      ?

      It would be nice to be able to do the following inside a stored procedure:

      create or replace table party (
          id_party bigint unsigned not null,
          field1 char,
          field2 char,
          field3 char
          primary key (id_party))
      engine = innodb;
       
      create or replace sequence seq_id_party start by 1 increment by 1;
       
      delimiter $$
       
      create or replace procedure create_party(inout io_reg_party row type of party)
      begin
          -- Validate io_reg_party's input fields.
       
          insert into party (
              id_party,
              field1,
              field2,
              field3)
          values (
              next value for seq_id_party,
              io_reg_party.field1,
              io_reg_party.field2,
              io_reg_party.field3)
          returning
              id_party
          into
              io_reg_party.id_party;
      end
      $$
       
      delimiter ;
      
      

      Regards.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              null_pointer_00 Rubén
              Votes:
              1 Vote for this issue
              Watchers:
              3 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.