[MDEV-7991] In PREPARED STATEMENTS impossible to use multiple statements Created: 2015-04-14  Updated: 2017-06-01

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

Type: Task Priority: Minor
Reporter: Mikhail Gavrilov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Example:

DELIMITER $$
 
CREATE PROCEDURE `test_dsql`()
BEGIN
	PREPARE sql_fn FROM 'select 1; select 2';
	EXECUTE sql_fn;
	DEALLOCATE PREPARE sql_fn;
END$$
 
DELIMITER ;

Query: call test_dsql()
 
Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'select 2' at line 1



 Comments   
Comment by Elena Stepanova [ 2015-04-15 ]

It's explicitly documented in both MySQL manual and MariaDB KB.

https://mariadb.com/kb/en/mariadb/prepare-statement/

The text must represent a single SQL statement, not multiple statements.

Should we treat it as a feature request?

Comment by Mikhail Gavrilov [ 2015-04-16 ]

Yes, possible treat it as a feature request?

Comment by Sergei Golubchik [ 2015-04-20 ]

In 10.1 you can prepare compound statement with many statements inside.

https://mariadb.com/kb/en/mariadb/using-compound-statements-outside-of-stored-programs/

Generated at Thu Feb 08 07:23:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.