• Your code run as a batch should work.

    I think what you are probably doing is highlighting and running the statements individually which would reproduce the error you are getting.