0

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! :)

APC
  • 144,005
  • 19
  • 170
  • 281
MoJoE3131
  • 5
  • 1
  • 5
  • You're probably better off keeping this sort of code in PL/SQL packages on the database server, and calling them from Forms, rather than implementing this code in your Oracle forms. – Jeffrey Kemp Aug 17 '15 at 06:56
  • Yes, following APC's answer below, that's what I've done and it's working fine. – MoJoE3131 Aug 19 '15 at 14:43

1 Answers1

1

ORA-00600 is Oracle's code for "unhandled side effects" ie bugs. There should be some additional information in the alert log. The standard ORA-00600 advice is to contact Oracle Support.

If you don't have a Support contract your options are limited. The ORA-00600 message should come with one or more arguments in square brackets, like this

 ORA-00600: internal error code, arguments: [17069], [55573516], [], [], [], [], [], []  

Those arguments are useful for identifying specific causes (the first number usually indicates an Oracle error number, documented or otherwise). You can try Googling for them.

As to your specific case I'm afraid we can only speculate. The object method JSON.TO_CHAR() calls a PL/SQL package function,JSON_PRINTER. That may be the problem. Forms PL/SQL shares a syntax with database PL/SQL but they are different engines; it may be you have come across a bug in how Forms PL/SQL works with SQL Types which have dependencies.

APC
  • 144,005
  • 19
  • 170
  • 281
  • I should have specified that all the brackets of the ORA-00600 are empty. Thanks for the hint about the dependencies. I'll try to look into it. – MoJoE3131 Aug 13 '15 at 11:43