Hi Najm, have you tried the test examples shipped in the tarball (src/pl/plpgsql/test)? In addition, you can find *lots* of examples (mostly with Hungarian comments) on ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz/Linux/PostgreSQL/strukturak/* PLPGSQL is one of the best things in PostgreSQL. Easy and useful. Feel free to ask if something can not be understood. Zoltan