I think I do see your problem. You have # delimited comments in your SQL, which is legal in some environment (e.g. MySQL) but not in Oracle (based on some articles I just found via the
.). Try again with your '#' characters swapped to '--', the Oracle way of doing line-end comments.