CREATE [OR REPLACE] [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }] PROCEDURE sp_name ([proc_parameter[,...]]) [characteristic ...] routine_body proc_parameter: [ IN | OUT | INOUT ] param_name type type: Any valid MariaDB data type characteristic: LANGUAGE SQL | [NOT] DETERMINISTIC | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } | SQL SECURITY { DEFINER | INVOKER } | COMMENT 'string' DELIMITER // CREATE PROCEDURE simpleproc (OUT param1 INT) BEGIN SELECT COUNT(*) INTO param1 FROM t; END; // CREATE PROCEDURE simpleproc2 ( OUT param1 CHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_bin' ) BEGIN SELECT CONCAT('a'),f1 INTO param1 FROM t; END; // CREATE OR REPLACE PROCEDURE simpleproc2 ( OUT param1 CHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_bin' ) BEGIN SELECT CONCAT('a'),f1 INTO param1 FROM t; END; // DELIMITER ;
SQL Справочник v0.05 © 2007-2025 Igor Salnikov aka SunDoctor