The preceding section describes the general structure of a block. Blocks facilitate code execution in PolarDB-O. An anonymous block is unnamed and is not stored in the database. After an anonymous block is executed, it is cleared from the application buffer.

This anonymous block cannot be re-executed unless the block code is re-entered into the application.

Anonymous blocks are useful for quick execution of programs, such as testing programs.

In most cases, the same block of code will be re-executed many times. To repeatedly run a block of code without re-entering the code each time, you can convert an anonymous block into a procedure or function with some simple modifications. The following section describes how to create a procedure or function that can be stored in the database and repeatedly called by another procedure, function, or application.