SQL 方言参考/过程式语言/存储过程
外观
< SQL 方言参考
数据库 | 创建语法 | 调用 |
---|---|---|
DB2 |
CREATE PROCEDURE procedure_name(...)
BEGIN
/* SQL code */
END
|
CALL procedure_name(...)
|
Firebird |
SET TERM $$ ;
CREATE PROCEDURE nameprocedure
(input_parameter_name datatype, ... )
RETURNS
(output_parameter_name datatype, ... )
AS
DECLARE VARIABLE variable_name datatype;
BEGIN
/* SQL code */
END$$
SET TERM ; $$
|
SELECT ... FROM function_name(...)
EXECUTE function_name(...)
|
MonetDB |
CREATE [ OR REPLACE ] PROCEDURE procedure_name(...)
BEGIN
/* SQL code */
END
CREATE [ OR REPLACE ] PROCEDURE procedure_name(...)
EXTERNAL NAME MAL_procedure_name
|
CALL procedure_name(...)
|
MySQL |
DELIMITER $$
CREATE PROCEDURE nameprocedure
(input_parameter_name datatype, ... )
BEGIN
/* SQL code */
END$$
DELIMITER ;
|
CALL nameprocedure(...)
|
Linter |
CREATE [OR REPLACE] PROCEDURE procedure_name([IN/OUT/INOUT] parameter_name datatype, ...) [RESULT datatype] [FOR DEBUG]
DECLARE
/* variables declaration */
CODE
/* stored procedure code
(including SQL code)*/
EXCEPTIONS
/* exceptions declarations */
END
|
CALL procedure_name(...)
EXECUTE procedure_name(...)
EXECUTE procedure_name(...) AS OWNER
SELECT procedure_name(...)
FROM ...
WHERE
procedure_name(...) = ...
|
OpenLink Virtuoso | ||
Oracle | CREATE [OR REPLACE] PROCEDURE procedure_name [ (parameter [,parameter]) ]
IS
[declaration_section]
BEGIN
executable_section
[EXCEPTION
exception_section]
END [procedure_name];
|
CALL [PACKAGE_NAME.]procedure_name(...);
BEGIN
[PACKAGE_NAME.]procedure_name(...);
END;
|
PostgreSQL |
CREATE FUNCTION function_name
(input_parameter_name datatype, ...)
RETURNS return_type
AS $$
DECLARE
variable_name datatype;
BEGIN
/* SQL code */
END;
$$ LANGUAGE plpgsql;
|
SELECT function_name(...)
|
SQL Server |
CREATE PROCEDURE nameprocedure
(input_parameter_name datatype, ... )
AS
/* SQL code */
GO
|
EXEC nameprocedure(...)
|
SQLite |
N/A |
N/A |