FUR-2771: improve sql stmt composition