Export to Excel failed with error ORA-06502 in xlsx_builder_pkg.finish
Opened this issue · 0 comments
gorjelin85 commented
In xlsx_builder_pkg.finish function
any usage of implicit type conversion should be avoided and changed with to_char()
, otherwise error ORA-06502 appears when
pls_integer variable is appended to clob t_xxx
together with varchar2 variable.
The error is raised when clob t_xxx
length is greater than 32767, e.g. when exporting large sets of data to Excel. For instance,
t_xxx := t_xxx || '<autoFilter ref="' ||
alfan_col( nvl( workbook.sheets( s ).autofilters( a ).column_start, t_col_min ) ) ||
nvl( workbook.sheets( s ).autofilters( a ).row_start, workbook.sheets( s ).rows.first() ) || ':' ||
alfan_col( coalesce( workbook.sheets( s ).autofilters( a ).column_end, workbook.sheets( s ).autofilters( a ).column_start, t_col_max ) ) ||
nvl( workbook.sheets( s ).autofilters( a ).row_end, workbook.sheets( s ).rows.last() ) || '"/>';
should be changed with
t_xxx := t_xxx || '<autoFilter ref="' ||
alfan_col( nvl( workbook.sheets( s ).autofilters( a ).column_start, t_col_min ) ) ||
to_char(nvl( workbook.sheets( s ).autofilters( a ).row_start, workbook.sheets( s ).rows.first() ) ) || ':' ||
alfan_col( coalesce( workbook.sheets( s ).autofilters( a ).column_end, workbook.sheets( s ).autofilters( a ).column_start, t_col_max ) ) ||
to_char(nvl( workbook.sheets( s ).autofilters( a ).row_end, workbook.sheets( s ).rows.last() ) ) || '"/>';
To_char
is already used somewhere inside the code, I think Anton Sheffer forgot about it in newer added features, such as autoFilter.
Unfortunately, I don't know whether he contributes to this code or not anymore and it's impossible to comment his original page , so I'm adressing to you.