Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84aa793

Browse files
author
Dmitry Volodin
committed
Use 8181 instead of 24575
1 parent 0f16efa commit 84aa793

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

source/core/ut_utils.pkb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ create or replace package body ut_utils is
211211
return l_result;
212212
end;
213213

214-
function clob_to_table(a_clob clob, a_max_amount integer := 24575, a_delimiter varchar2:= chr(10)) return ut_varchar2_list is
214+
function clob_to_table(a_clob clob, a_max_amount integer := 8191, a_delimiter varchar2:= chr(10)) return ut_varchar2_list is
215215
l_offset integer := 1;
216216
l_length integer := dbms_lob.getlength(a_clob);
217217
l_amount integer;
@@ -329,4 +329,4 @@ create or replace package body ut_utils is
329329
end;
330330

331331
end ut_utils;
332-
/
332+
/

source/core/ut_utils.pks

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,20 @@ create or replace package ut_utils authid definer is
171171
Parameters:
172172
a_clob - the text to be split.
173173
a_delimiter - the delimiter character or string (default chr(10) )
174-
a_max_amount - the maximum length of returned string (default 24575)
174+
a_max_amount - the maximum length of returned string (default 8191)
175175

176176
Returns:
177177
ut_varchar2_list - table of string
178178

179179
Splits a given string into table of string by delimiter.
180-
Default value of a_max_amount is 24575 because of code can contains multibyte character.
180+
Default value of a_max_amount is 8191 because of code can contains multibyte character.
181181
The delimiter gets removed.
182182
If null passed as any of the parameters, empty table is returned.
183183
If split text is longer than a_max_amount it gets split into pieces of a_max_amount.
184184
If no text between delimiters found then an empty row is returned, example:
185185
string_to_table( 'a,,b', ',' ) gives table ut_varchar2_list( 'a', null, 'b' );
186186
*/
187-
function clob_to_table(a_clob clob, a_max_amount integer := 24575, a_delimiter varchar2:= chr(10)) return ut_varchar2_list;
187+
function clob_to_table(a_clob clob, a_max_amount integer := 8191, a_delimiter varchar2:= chr(10)) return ut_varchar2_list;
188188

189189
function table_to_clob(a_text_table ut_varchar2_list, a_delimiter varchar2:= chr(10)) return clob;
190190

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
--Arrange
22
declare
33
l_varchar2_byte_limit integer := 32767;
4-
l_workaround_byte_limit integer := 24575;
4+
l_workaround_byte_limit integer := 8191;
55
l_singlebyte_string_max_size varchar2(32767 char) := rpad('x',l_varchar2_byte_limit,'x');
66
l_twobyte_character char(1 char) := 'ж';
77
l_clob_multibyte clob := l_twobyte_character||l_singlebyte_string_max_size; --here we have 32769(2+32767) bytes and 32768 chars
88
l_expected ut_varchar2_list := ut_varchar2_list();
99
l_result ut_varchar2_list;
1010
begin
11-
l_expected.extend(2);
11+
l_expected.extend(1);
1212
l_expected(1) := l_twobyte_character||substr(l_singlebyte_string_max_size,1,l_workaround_byte_limit-1);
13-
l_expected(2) := substr(l_singlebyte_string_max_size,l_workaround_byte_limit-1+1);
1413
--Act
1514
l_result := ut_utils.clob_to_table(l_clob_multibyte);
1615
--Assert
17-
if l_result = l_expected then
16+
if l_result(1) = l_expected(1) then
1817
:test_result := ut_utils.tr_success;
1918
else
20-
dbms_output.put_line('expected: lengths '||length(l_expected(1))||' and '||length(l_expected(2))||', got lengths: '||length(l_result(1))||' and '||length(l_result(2)));
19+
dbms_output.put_line('expected: 1st string length '||length(l_expected(1))||', got 1st string length: '||length(l_result(1)));
2120
end if;
2221
end;
2322
/

0 commit comments

Comments
 (0)