making SQL statement local