Thanks to visit codestin.com
Credit goes to postgrespro.com

Chapter 42. PL/pgSQLSQL Procedural Language