CREATE PROCEDURE syntax

From InterBase

Go Up to Creating Procedures


CREATE PROCEDURE name
[(param data_type [, param data_type ])]
 [RETURNS (param data_type [, param data_type ])]
 AS
 <procedure_body>;
<procedure_body> = [<variable_declaration_list>]

 <block>
<variable_declaration_list> =
 DECLARE VARIABLE var data_type;
[DECLARE VARIABLE var data_type; ]
<block> =
 BEGIN
 <compound_statement>
 [<compound_statement> ]
 END
<compound_statement> = {<block> | statement;}
Argument Description

<name>

Name of the procedure; must be unique among procedure, table, and view names in the database.

<param> <data_type>

Input parameters that the calling program uses to pass values to the procedure.

  • <param>: Name of the input parameter, unique for variables in the procedure.
  • <data_type>: An InterBase data type

RETURNS
<param data_type>

Output parameters that the procedure uses to return values to the calling program

  • <param>: Name of the output parameter, unique for variables within the procedure.
  • <data_type>: An InterBase data type
  • The procedure returns the values of output parameters when it reaches a SUSPEND statement in the procedure body.

AS

Keyword that separates the procedure header and the procedure body.

DECLARE VARIABLE
<var> <data_type>

Declares local variables used only in the procedure

  • Each declaration must be preceded by DECLARE VARIABLE and followed by a semicolon (;).
  • <var>: Name of the local variable, unique for variables in the procedure.

<statement>

  • Any single statement in InterBase procedure and trigger language.
  • Each statement except BEGIN and END must be followed by a semicolon (;).

Advance To: