Database design import massive csv files is there a more efficient way?
LOAD DATA ... INTO staging ...; It has VARCHARs in place of INTs, etc.  It also has some unique id (perhaps auto_increment) for step 3.
Copy "bad" rows to debtor_err in one pass:

INSERT INTO debtor_err
     SELECT ... 
         WHERE LENGTH(..) &gt; .. 
            OR NOT EXISTS( SELECT * ... )  -- FK check
            OR ... &gt; 12
Copy "good" rows to debtor table -- Use JOIN to see which ones are good

INSERT INTO debtor
    SELECT ...   -- where nec, convert from VARCHAR
        FROM staging s
        LEFT JOIN debtor_err e
            ON s.id = e.id  -- suitable UNIQUE key
        WHERE e.id IS NULL  -- to get the non-error rows
DELETE FROM staging; -- Reset for next time.  (Using DELETE instead of TRUNCATE may avoid id not working 'right' the second time around.)


Suggestion:  Use MyISAM for staging; InnoDB for permanent tables.