A statement answers one question. A [[Invantive UniversalSQL/Grammar/Statement Types/PSQL Block|PSQL block]] is what is written when the answer decides what happens next: a loop over rows, a condition, a variable, a call to a procedure. It runs in the editor like any other statement, with "Execute". ## Running One A block is written between `begin` and `end;` and is executed as one statement, however many statements it holds. The [[Invantive Query Tool/Results|Results]] panel shows what the block finally selected, where it selected anything; a block which only writes shows the rows it affected on the status bar. ## Seeing What It Does A block which runs for minutes says nothing by itself, so two panels are worth having open beside it: - [[Invantive Query Tool/DBMS Output|DBMS Output]] collects what the block writes with `dbms_output.put_line`, which is the cheapest way to follow a loop. The panel has to be switched on before the block runs; output written while it was off is not shown. - [[Invantive Query Tool/Progress|Progress]] draws the statements inside the block as they run, so a loop which is slower than expected shows which of its statements is the slow one. ## Errors A block which fails names the line it failed on, and "Goto Line" in the "Editor" tab jumps there; see [[Invantive Query Tool/Editing Text|Editing Text]]. The message code beside the text - `itgenpse147`, `itgensql056` - is what the [forums](https://forums.invantive.com) and this documentation are indexed by. A block is not a transaction. What the statements before the failure did stands, exactly as with [[Invantive Query Tool/Executing Statements|Execute All]] over a document. ## Where the Language Is Documented The grammar of a block - the declarations, the control flow, the cursors, the exception handling - is documented under [[Invantive UniversalSQL/General/Procedural SQL|Procedural SQL]] and in the [[Invantive UniversalSQL/Grammar/Statement Types/PSQL Block|PSQL Block]] page. Blocks which are worth keeping are stored as PSQL objects in the data dictionary and are then callable by name from anywhere.