Use Variable From One Function In Sql