Rachel: I didn't read thru all your code, only the very beginning. But we've had this discussion before on this list -- I see that you either create the temp table if it isn't there, or delete rows from the table if it is there. I am one of those people who ALWAYS recreate temp tables, never deleting rows from the table except for a few deletes during the processing. If this program is run several times from the same machine without a database disconnect, so a bunch of deletes of all rows, there's a good chance at some point you will get a corrupted temp table in my experience.
Karen

