First off, what you have there is a couple of functions - all by themselves, they have no idea what they're meant to do - they need to be called, with parameters specifying what objects they are meant to act on.
If you want to call them repeatedly throughout the whole time your database is...