I'm trying to use PL/JSON in a Oracle 11g form.
When I run the following code (taken from the example file ex1.sql of PL/JSON) directly on the database it works fine.
declare
obj json;
begin
obj := json('{"a": true }');
obj.print;
--more complex json:
obj := json('
{
"a": null,
"b": 12.243,
"c": 2e-3,
"d": [true, false, "abdc", [1,2,3]],
"e": [3, {"e2":3}],
"f": {
"f2":true
}
}');
obj.print;
obj.print(false); --compact way
end;
/
returning
{
"a" : true
}
{
"a" : null,
"b" : 12.243,
"c" : 0.002,
"d" : [true, false, "abdc", [1, 2, 3]],
"e" : [3, {
"e2" : 3
}],
"f" : {
"f2" : true
}
}
{"a":null,"b":12.243,"c":0.002,"d":[true,false,"abdc",[1,2,3]],"e":[3,{"e2":3}],"f":{"f2":true}}
Now, I want to use the same logic but directly in a Oracle 11g form with the following code.
PROCEDURE Ex1_Test IS
obj json;
begin
obj := json('{"a": true }');
:MyField1 := obj.to_char;
--more complex json:
obj := json('
{
"a": null,
"b": 12.243,
"c": 2e-3,
"d": [true, false, "abdc", [1,2,3]],
"e": [3, {"e2":3}],
"f": {
"f2":true
}
}');
:MyField2 := obj.to_char;
:MyField3 := obj.to_char(false); --compact way
end;
Then I get the generic internal error from Oracle ORA-00600 : internal error code
at the line 7 :MyField1 := obj.to_char;
.
What am I doing wrong? Is it that what I'm trying to do is not possible?
Thank for the help! :)