Why Use PL/pgSQL?Enabling a Database with PL/pgSQLThe Structure of PL/pgSQLWriting FunctionsInserting PL/pgSQL Functions into a DatabaseA Simple ExampleUsing Typecast OperationsSimple Flow of Control StructuresUsing IF/ELSEUsing LOOP/EXIT, WHILE, and FOR LoopsPL/pgSQL also supports FOR loops:Using Functions in PL/pgSQLFunction OverloadingSELECT Statements and PL/pgSQL FunctionsWorking with SELECT and LoopsException HandlingMaking Functions More Independent from DatatypesWriting TriggersAutomatically Created VariablesOracle's PL/SQL and PL/pgSQL—Comparing Two WorldsThe Main DifferencesQuotingFunction OverloadingPostgreSQL and Database CursorsCreating and Replacing FunctionsMaking Life Easier with instrLocking TablesFunctions and Transactions