[MDEV-25860] Implement INSERT INTO <TABLE> VALUES <VALUES> RETURNING <FIELDS> INTO <HOST_VARIABLES> Created: 2021-06-05  Updated: 2021-06-05

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Rubén Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: 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.


Generated at Thu Feb 08 09:40:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.