This may not be a direct answer but just a recommended way of managing long and relatively complex query.
Ensure that the query produces a resultset working with it outside of QlikView. Assuming that the query is good, my recommendation is to create a view with the query. Then in QlikView, just use a select query to extract data from the view. That will help keep your QlikView document clean and debugging may become simple.
First, I agree with QueueWeRavn
... well I had problems like this before, trying to run a complex query directly from QV.
But, as far as I could go, the problem was with my drivers. Apparently I couldn't use some function from there (e.g. NVL)
So, can you try to remove those lines with this expressions for testing purposes? If that's your case, you will need to replace them using a Load statement above sql select .
Hope this helps,