mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
41 lines
1.3 KiB
Text
41 lines
1.3 KiB
Text
CREATE TABLE t1 (id INT);
|
|
DELIMITER $$;
|
|
CREATE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment1' BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
DELIMITER ;$$
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
DELIMITER $$;
|
|
--error ER_SP_ALREADY_EXISTS
|
|
CREATE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment2'
|
|
BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
SELECT comment FROM mysql.proc WHERE name='proc1'$$
|
|
|
|
CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) COMMENT 'comment3'
|
|
BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
SELECT comment FROM mysql.proc WHERE name='proc1'$$
|
|
|
|
--error ER_WRONG_USAGE
|
|
CREATE OR REPLACE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) COMMENT 'comment4'
|
|
BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
SELECT comment FROM mysql.proc WHERE name='proc1'$$
|
|
|
|
CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment5'
|
|
BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
SELECT comment FROM mysql.proc WHERE name='proc1'$$
|
|
|
|
DELIMITER ;$$
|
|
DROP PROCEDURE proc1;
|
|
DELIMITER $$;
|
|
CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
DELIMITER ;$$
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP PROCEDURE IF EXISTS proc1;
|
|
DROP PROCEDURE IF EXISTS proc1;
|