ziopex / plsql-utils

Automatically exported from code.google.com/p/plsql-utils
0 stars 0 forks source link

csv_util_pkg.csv_to_array fails on multibyte chars #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create some cvs contatining multibyte unicode characters, i try russian
2. call clob_to_csv - it will raise string buffer too small exception in 
cvs_to_array call

Oracle XE 10g, Windows, UTF8 database
What version of the product are you using? On what operating system?

Solution: 
change in cvs_to_array
  L_CURRENT          VARCHAR2(1);
  l_next             varchar2(1);
to
  L_CURRENT          VARCHAR2(1 CHAR);
  l_next             varchar2(1 CHAR);

inserting CHAR keyword cause database allocate enough bytes to store defined 
number of multibyte characters

Original issue reported on code.google.com by Vadi...@mail.ru on 15 Jun 2012 at 11:02

GoogleCodeExporter commented 8 years ago

Original comment by thehunge...@gmail.com on 23 Jul 2012 at 7:16

GoogleCodeExporter commented 8 years ago
I've gotten that error as well, with a non-multibyte clob. I fixed it with the 
following kludge, in my case the CSV had lines that were longer than 4000 
characters long (and I didn't care if they were truncated):

function csv_to_array (p_csv_line in varchar2,
                       p_separator in varchar2 := g_default_separator) return t_str_array
as
...
  procedure save_column is
  begin
    ...
    l_returnvalue(l_idx) := SUBSTR(l_current_column,1,4000);
    ...

Original comment by jeffrey....@jk64.com on 16 Aug 2012 at 12:12

GoogleCodeExporter commented 8 years ago
Vadimon's fix added to the latest version of the package.

Original comment by thehunge...@gmail.com on 17 Feb 2013 at 9:20