Home > database >  A brief introduction Gbase8a MPP Cluster database stored procedures
A brief introduction Gbase8a MPP Cluster database stored procedures

Time:02-23

Stored procedure is a set of a set of SQL statements can accomplish a specific function, after the compilation is stored in the database, the user when performing a stored procedure, you need to specify the name of the stored procedure and parameters is given (if the stored procedure contains parameters)
Storage process to create the syntax of the format the following example:
CREATE PROCEDURE & lt; Proc_name & gt; ([& lt; parameter_1 & gt; [...] [parameter_n]])
[characteristic...
The BEGIN
END

Parameter description
1, & lt; Proc_name & gt; , & lt; Func_name & gt; To create the name of the stored procedure, within the same database, the stored procedure
Names must be unique, the name of the stored procedure allows only a to z, a to z, 0 ~ 9, underline, and not only contains
Digital;
2, ([& lt; parameter_1 & gt; [...] [parameter_n]]) define the parameters of the stored procedure, the definition of each parameter format
Is: & lt; Parameter direction & gt; 3, of the stored procedure & lt; Parameter direction & gt; Determine the parameters as input, output and input and output, can only take IN and OUT,
One of INOUT, function & lt; Parameter direction & gt; Only can be input IN;
4, & lt; The parameter name & gt; In the same stored procedure must be the only, only allow a to z, a to z, 0 ~ 9, underline, and
Not only contains Numbers;
5, & lt; Parameter data types & gt; The data type of the specified argument.
6, & lt; The process definition & gt; , & lt; The function definitions & gt; Is the combination of a series of SQL statements, which contains some data manipulation to the
With a certain function logic;
7, define a stored procedure, the stored procedure name at the back of the bracket is necessary, even without any parameters, also can't save
Slightly; GBase 8 a MPP Cluster product manuals 6 fault management
In 8, if a stored procedure, function & lt; The process definition & gt; Contains only a single SQL statement, you can omit the BEGIN and
END, otherwise, in defining a stored procedure, you must use the BEGIN... The END structure of the related SQL statement
Group together to form & lt; The process definition & gt;;
9, stored procedures, functions can be nested;
10, the type is GBase 8 a MPP Cluster support the data type of the

GBase 8 a MPP Cluster use CALL a stored procedure CALL statements, syntax format is as follows:
CALL [database_name.] proc_name ([& lt; argument list & gt;] )
  • Related