--- title: 'PL/pgSQL Block Structure' page_title: 'PL/pgSQL Block Structure' page_description: 'This tutorial explains you the block structure of PL/pgSQL and shows you step by step how to develop anonymous blocks.' prev_url: 'https://www.postgresqltutorial.com/postgresql-plpgsql/plpgsql-block-structure/' ogImage: '/postgresqltutorial/plpgSQL-block-Structure.png' updatedOn: '2024-04-19T08:08:48+00:00' enableTableOfContents: true previousLink: title: 'Dollar-Quoted String Constants' slug: 'postgresql-plpgsql/dollar-quoted-string-constants' nextLink: title: 'PL/pgSQL Variables' slug: 'postgresql-plpgsql/plpgsql-variables' --- **Summary**: in this tutorial, you will learn about the block structure of PL/pgSQL and how to write and execute your first PL/pgSQL block. ## Introduction to PL/pgSQL Block Structure PL/pgSQL is a block\-structured language. Here’s the syntax of a block in PL/pgSQL: ```sql [ <