Procedural language (PL) subprograms in OceanBase Database supports only compiled execution. This topic describes the PL subprogram execution mechanism that involves the OBServer, SQL engine, and PL engine.
Compared with interpreted execution, compiled execution provides better performance, especially when the PL engine contains a large amount of computing work.
In the framework of compiled execution, PL source code is compiled into executable code of the corresponding platform. OBServer directly uses the compiled executable code for PL engine execution. The compiled PL code is cached. Therefore, you need to compile the PL subprogram only once.

A PL subprogram is stored in an OBServer after being defined. When an application calls a stored procedure, the OBServer reads the definition of the PL subprogram from the data dictionary, compiles the PL subprogram into executable binary code based on the definition, and then stores the binary code in PL cache. The PL engine obtains the executable code from the PL cache and interacts with the SQL engine to execute the PL subprogram.
You can embed one stored procedure in another. For example, you can call a stored procedure in the current PL block.