First of all, something you must do: ALWAYS specify the type of locks (NO-LOCK or EXCLUSIVE-LOCK) when reading records from any database table table. Otherwise you are asking for lock table overflows and locking issues with other users.
as to your code you posted, it makes absolutely no...