Have you seen Roberto's guide about the differences between plsql and plpgsql?
http://www.postgresql.org/idocs/index.php?plpgsql-porting.html
Regarding the notes package as example: I saw that it has one major shortcoming in that it uses the context_id of acs_objects to distinguish which package a note belongs to, which is bad practice. The context_id is only there for security context information, not for application specific data (at least that's the latest state of the discussion as far as I know).
So there should actually be a package_id column in the notes table. Take a look at e.g. packages/page/www/index.tcl for a simple example how to handle this (don't take the lack of templating in that package as an example though 😉)