oracle-databaseutf-8oracle12cora-00600

ORA-00600 when using Select from table in oracle 12.2.0.1.0


We're migrating our database from WE8MSWIN1252 to AL32UTF8 to support multiple languages. We get ORA-00600 error when trying to compile the TestUtf8 package:

CREATE TaBle Test_Utf8(
                       TestUtf8Key NUMBER(5) PRIMARY KEY,
                       Description VARCHAR2(2000),
                       Code VARCHAR2(10)
                     );


CREATE OR REPLACE TYPE UTF8Type_TableOfVarchar IS TABLE OF VARCHAR2(32767);


CREATE OR REPLACE PACKAGE TestUtf8Tools AS

  FUNCTION Split( psList       VARCHAR2,
                  psSeparator  VARCHAR2 := ',' )  RETURN UTF8Type_TableOfVarchar PIPELINED;

END TestUtf8Tools;


CREATE OR REPLACE PACKAGE BODY TestUtf8Tools AS

  FUNCTION Split ( psList       VARCHAR2,
                   psSeparator  VARCHAR2 := ',' ) RETURN UTF8Type_TableOfVarchar PIPELINED IS
    intidx      INTEGER;
    sList VARCHAR2(4000) := psList;
  BEGIN
    IF psList IS NOT NULL THEN
      LOOP
        intidx := INSTR(sList,psSeparator);
        IF intidx > 0 then
          PIPE ROW(SUBSTR(sList,1,intidx-1));
          sList := SUBSTR(sList,intidx+LENGTH(psSeparator));
        ELSE
          PIPE ROW(sList);
          EXIT;
        END IF;
      END LOOP;
    ELSE
      PIPE ROW(psList);
    END IF;
    RETURN;
  END Split;

END TestUtf8Tools;

    CREATE OR REPLACE PACKAGE TestUtf8 AS

FUNCTION TestFROMTable RETURN VARCHAR2;

END TestUtf8;

CREATE OR REPLACE PACKAGE BODY TestUtf8 AS

FUNCTION TestFROMTable RETURN VARCHAR2   IS
 sResult VARCHAR2(4000);
 sCode VARCHAR2(10);
 sDescription VARCHAR(4000);

  CURSOR cCursor IS
    SELECT Code, Description
      FROM Test_Utf8
     WHERE TestUtf8Key = 1;

 BEGIN

  OPEN  cCursor;
  FETCH cCursor INTO Scode, sDescription;
  CLOSE cCursor;

  sResult := Scode;
  IF 1 = 1 THEN 
    sResult := sResult || ', ' || sDescription;
  END IF;

SELECT listagg(COLUMN_VALUE, ', ') within group(order by COLUMN_VALUE) INTO sResult FROM (SELECT DISTINCT COLUMN_VALUE FROM TABLE(TestUtf8Tools.Split(sResult)));

  RETURN(sResult);
END;
END TestUtf8;

We get the following errors:

PL/SQL: SQL Statement ignored
PL/SQL: ORA-00600: internal error code, arguments: [qctbyt :
     bfc], [65532], [18446744073709551612], [1], [873], [1], [1], [0],
     [], [], [], []

Apparently the error is caused by

SELECT listagg(COLUMN_VALUE, ', ') within group(order by COLUMN_VALUE) INTO sResult FROM (SELECT DISTINCT COLUMN_VALUE FROM TABLE(TestUtf8Tools.Split(sResult)));

This worked fine in oracle 12.1.0.2.0 but not in 12.2.0.1.0. Do you have any idea why this worked before but not in 12.2 ? Please note also that we find a fix for 12.2 by changing the code to:

SELECT listagg(COLUMN_VALUE, ', ') within group(order by COLUMN_VALUE) INTO sResult FROM  TABLE(TestUtf8Tools.Split(sResult)).

Thanks for your help.


Solution

  • This is a bug related to Oracle 12.2, there is already a patch for linux OS, this is already fixed in Oracle 18