SELECT idx, err_msg
FROM (
  SELECT
    rownum as rnm,
    a.idx,
    a.err_msg,
    csv
  FROM impcsv a
  WHERE a.wseq = :wseq
    AND a.err_msg IS NOT NULL
  ORDER BY a.idx
)
WHERE rnm<=500
union all
select
  null as idx,
  '他．．．' as err_msg
from dual
