• So would it be possible to rewrite this so as to avoid the cursor?

    ATBCharles Kincaid