You are generating your SQL code to a BUFFERED output stream. Which is still open when you execute the OS-COMMAND because you did a simple "output close" without the stream name. The SQL script is not complete on disk -- that's why you are getting an error in the middle of the statement when run from within the session but everything looks fine once the session has ended and you run it manually.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.