Tom, try using parfile ... havign complicated query clause and the need for escaping for shell makes it all complicated. Try with parfile instead. Raj