Execution flow of an sql statements
The execution flow can be divided into four stage.
Not all Sql Statements will use all the stages:
- Parse: at the beginning the statement must be parsed, this mean check the syntax and associate it with the cursor. It also verifies if the privilege are correct and if the objects referenced really exists
- Bind: this stage is execute only when the statement contain input data to be supplied at runtime. For each placeholder, values must be supplied to complete the SQL statement
- Execute: at this point the server execute the statement, This is the last point for all the SQL operation except SELECT
- Fetch: this operation retrieves all the rows that satisfied the query. The fetch operation will continue until all the rows are returned. This step is execute only for SELECT statements