I have a stored procedure which loads a table from a flat file. It basically contains a LOOP which gets a line, builds a record, and then inserts the record into a table. However, the way it handles EXCEPTION errors in the build record process leaves a lot to be desired (for example, if a field is offset incorrectly, it may blow up with a standard date exception, which is bad if a record has more than one date field or it happens in the middle of processing, forcing me to count bits in the load file). Before I spend too much time brain-storming, I am wondering if anyone else has come up with something.
I am considering displaying the file line with the exception error underneath, offset to start at the field with the error...
I am considering displaying the file line with the exception error underneath, offset to start at the field with the error...
Code:
[...]
WHEN OTHERS THEN
DBMS_OUTOUT.put_line(c_spacer || buffer);
DBMS_OUTOUT.put_line(c_spacer || v_offset || SQLERRM);