428d851913
* refactor: generic rename to mysql * refactor: g4 with mysql syntax * test: mysql syntax * refactor: remove useless keywords * refactor: remove nonReserved keywords * refactor: lint specificFunction --------- Co-authored-by: liuyi <liuyi@dtstack.com>
24 lines
793 B
SQL
24 lines
793 B
SQL
-- https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html
|
|
|
|
/* CREATE
|
|
[DEFINER = user]
|
|
PROCEDURE [IF NOT EXISTS] sp_name ([proc_parameter[,...]])
|
|
[characteristic ...] routine_body
|
|
|
|
proc_parameter:
|
|
[ IN | OUT | INOUT ] param_name type
|
|
|
|
characteristic: {
|
|
COMMENT 'string'
|
|
| LANGUAGE SQL
|
|
| [NOT] DETERMINISTIC
|
|
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
|
|
| SQL SECURITY { DEFINER | INVOKER }
|
|
} */
|
|
|
|
|
|
CREATE DEFINER = 'admin'@'localhost' PROCEDURE account_count() SQL SECURITY INVOKER SELECT 'Number of accounts:', COUNT(*) FROM mysql.user;
|
|
|
|
CREATE PROCEDURE AddTwoNumbers(IN a INT, IN b INT) SELECT a + b AS Sum;
|
|
CREATE PROCEDURE IF NOT EXISTS AddTwoNumbers(IN a INT, IN b INT) SELECT a + b AS Sum;
|