Thanks a lot!
Andres R Barcia, October 02, 2019 - 7:31 pm UTC
Ok, thanks, I'll wait for the DBA's to perform the upgrade... a couple of years.
in the meanwhile i'll try storing the characters as Unicode.
Clarification
Vic, October 04, 2019 - 10:28 am UTC
Are you saying that parsing special characters will work with json functions in an oracle 18+ database regardless of the characterset. If I upgrade my 1252 database to oracle 18, then the json functions will work?
October 04, 2019 - 12:17 pm UTC
I'm not sure all special characters will work, but accented characters work fine in 18c for me.
re: Clarification
Stew Ashton, October 04, 2019 - 2:53 pm UTC
In 19c with a database character set of AL32UTF8, Json_object_t.Parse works with the first 1900 unicode characters. This includes any characters that require escaping.
DECLARE
L_datos CLOB;
L_json Json_object_t;
BEGIN
select json_object('value' is listagg(unistr('\'||to_char(level-1,'fm000X'))) returning clob)
into l_datos
from dual
connect by level <= 1900;
L_json := Json_object_t.Parse (L_datos);
END;
/Best regards,
Stew Ashton
Update
Vic, November 04, 2019 - 11:52 am UTC
I tested an indeed the issue is fixed in 19
SQL*Plus: Release 19.0.0.0.0 Version 19.5.0.0.0
SQL> SELECT value$ FROM sys.props$ WHERE name = 'NLS_CHARACTERSET' ;
VALUE$
--------------------------------------------------------------------------------
WE8MSWIN1252
SQL> declare
2
3 l_json_obj JSON_OBJECT_T;
4 5 begin
6
l_json_obj := JSON_OBJECT_T.parse(' { "MedicalConditionDiagnosis": "Sclérose latérale amyotrophique (maladie de Lou-Gehrig)" } ');
7 8 9 DBMS_OUTPUT.put_line('l_json_obj ' || l_json_obj.TO_STRING);
10
end; 11
12 /
PL/SQL procedure successfully completed.
November 04, 2019 - 1:12 pm UTC
Thanks for confirming
Workaround
Vic, November 04, 2019 - 11:54 am UTC
convert function...until you upgrade.
That is what we are doing.
declare
l_json_obj JSON_OBJECT_T;
begin
l_json_obj := JSON_OBJECT_T.parse(convert('{ "MedicalConditionDiagnosis": "Sclérose latérale amyotrophique (maladie de Lou-Gehrig)" } ','AL32UTF8','WE8MSWIN1252'));
DBMS_OUTPUT.put_line('l_json_obj ' || l_json_obj.TO_STRING);
DBMS_OUTPUT.put_line('l_json_obj ' || l_json_obj.get_string('MedicalConditionDiagnosis'));
end;
November 04, 2019 - 1:12 pm UTC
Thanks for sharing.