In the MySQL mode of OceanBase Database, PL stored programs include stored procedures, stored functions, and triggers.
The MySQL mode of OceanBase Database supports PL stored objects of the following types:
Stored procedure: A stored procedure is created by using the
CREATE PROCEDUREstatement and called by using theCALLstatement. A stored procedure has no return value. However, it can have output parameters and generate a result set to return to the client program.Stored function: A stored function is created by using the
CREATE FUNCTIONstatement and is used in a similar way to a built-in function. You can call a stored function in an expression to return a value during expression evaluation.Trigger: A trigger is generated by using the
CREATE TRIGGERstatement and is associated with a table. Operations such as insert or update on a table can fire triggers.
Stored procedures and functions are stored routines, and stored routines and triggers are stored programs.
Each stored program has a body that consists of multiple SQL statements separated with semicolons (;). The body of a stored procedure begins with the BEGIN keyword and ends with the END; keyword.