• as $$ ... $$: The function body is a string. PL/pgSQL allows for quoting using:
    • '...': But this is problematic for code containing single quote marks, e.g. string literals.
    • $$...$$

  • language plpgsql: Specifies the language of the code. (Remeber, the code is in a string.)

  • begin ... end:
    • Delimits the body of a function.
    • No semicolons
    • Inside the block, statements are terminated by semicolons.
    • This is PL/pgSQL syntax. They have nothing to do with transactions.
    • The SQL statements begin and end (with semi-colons in most contexts) are used to delimit transactions.

  • return dollars * 1.2: The actual function logic.