[MDEV-21033] Call procedures dynamically with table/field names Created: 2019-11-11  Updated: 2020-01-23

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

Type: Task Priority: Major
Reporter: ceau Assignee: Unassigned
Resolution: Unresolved Votes: 0
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.


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