Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PostgreSQL 11 Server Side Programming Quick Start Guide

You're reading from   PostgreSQL 11 Server Side Programming Quick Start Guide Effective database programming and interaction

Arrow left icon
Product type Paperback
Published in Nov 2018
Publisher
ISBN-13 9781789342222
Length 260 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Luca Ferrari Luca Ferrari
Author Profile Icon Luca Ferrari
Luca Ferrari
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

An introduction to PL/pgSQL

PL/pgSQL is an imperative SQL-like language that offers several features to write a piece of runnable code. Besides SQL, this is the default language used in PostgreSQL to write functions, procedures, triggers, and programs in general.

PostgreSQL has a special statement called DO that accepts a PL/pgSQL piece of code and executes it as an anonymous code block. This is particularly handy to learn features of the language or to execute a code snippet without having to wrap it into a function or a routine. The syntax of the DO statement is quite straightforward and only requires us to specify the block of code to execute:

DO <plpgsql code block>;

In the rest of the chapter, the DO statement will be used to run PL/pgSQL pieces of code and demonstrate all the main features of the language.

A runnable PL/pgSQL piece of code must contain at least one...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime