FirebirdSQL/3/Store Procedure
出自VFP Wiki
目錄 |
存储过程是什么
預存程序(Stored Procedure)(簡稱SP)是使用者預先寫好的資料庫Script。
SP最大好處是可以降低資料在網路來回傳送與網路負載,因為我們將處理資料的程式碼寫在伺服器端,那麼客戶端將只會收到經過處理後的紀錄,如此資料庫伺服器效能會大大的提升.
存储过程(Stored Procedure)相关語法
- 存储过程(Stored Procedure)创建的語法:
CREATE PROCEDURE name [( param datatype [, param datatype …])] [RETURNS ( param datatype [, param datatype …])] AS <procedure_body>; <procedure_body> = [<variable_declaration_list>] <block> <variable_declaration_list> = DECLARE VARIABLE var datatype; [DECLARE VARIABLE var datatype; …] <block> = BEGIN < compound_statement> [< compound_statement> …] END <compound_statement> = {<block> | statement;}
- Stored Procedure 修改的語法:
ALTER PROCEDURE name [( var datatype [, var datatype …])] [RETURNS ( var datatype [, var datatype …])] AS procedure_body;
- Stored Procedure 移除的語法:
DROP PROCEDURE name;
Stored Procedure 範例
- Stored Procedure 建立的語法:
- Stored Procedure 修改的語法:
- Stored Procedure 移除的語法: