最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sql - FOR LOOP statement from collection in procedure body (Oracle21) - Stack Overflow

programmeradmin1浏览0评论

The following procedure does not compile:

CREATE PROCEDURE P_Test
IS
   TYPE intvec_t IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
   vec intvec_t := intvec_t(3 => 10, 1 => 11, 100 => 34);
BEGIN
   FOR i IN INDICES OF vec LOOP
      null;
   END LOOP;
END;

I get an error:

ERROR at line 1: ORA-00600: internal error code, arguments: [kglidinsi1], [1], [], [], [], [], [], [], [], [], [], []

Although similar code in the anonymous block compiles:

DECLARE
   TYPE intvec_t IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
   vec intvec_t := intvec_t(3 => 10, 1 => 11, 100 => 34);
BEGIN
   FOR ty IN INDICES OF vec LOOP
      null;
   END LOOP;
END;

What could be the reason?

The following procedure does not compile:

CREATE PROCEDURE P_Test
IS
   TYPE intvec_t IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
   vec intvec_t := intvec_t(3 => 10, 1 => 11, 100 => 34);
BEGIN
   FOR i IN INDICES OF vec LOOP
      null;
   END LOOP;
END;

I get an error:

ERROR at line 1: ORA-00600: internal error code, arguments: [kglidinsi1], [1], [], [], [], [], [], [], [], [], [], []

Although similar code in the anonymous block compiles:

DECLARE
   TYPE intvec_t IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
   vec intvec_t := intvec_t(3 => 10, 1 => 11, 100 => 34);
BEGIN
   FOR ty IN INDICES OF vec LOOP
      null;
   END LOOP;
END;

What could be the reason?

Share Improve this question edited Feb 10 at 18:50 Dale K 27.4k15 gold badges58 silver badges83 bronze badges asked Feb 10 at 10:36 Ольга ЗайчукОльга Зайчук 511 bronze badge 2
  • 1 ORA-600s are internal errors (bugs in Oracle's core code). They can only be investigated at Oracle Support. However, you can often get lucky by making changes until the error goes, away, effectively pinpointing what set of circumstances it doesn't like, then come up with a workaround that avoids the bug. This is often faster than SR resolution with Oracle Support. – Paul W Commented Feb 11 at 3:02
  • I successfully compiled in 23c. Not sure why it is not working in 21c though, do you have flexibility of upgrading? – Aaron Commented Feb 13 at 6:13
Add a comment  | 

1 Answer 1

Reset to default 0

What is your Database version?

  • If you are on Oracle 19c or earlier, avoid INDICES OF and use FIRST/NEXT looping as:
CREATE PROCEDURE P_Test
IS
   TYPE intvec_t IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
   vec intvec_t := intvec_t(3 => 10, 1 => 11, 100 => 34);
   i PLS_INTEGER;
BEGIN
   i := vec.FIRST;  -- Start from the first index
   WHILE i IS NOT NULL LOOP
      -- Do nothing (NULL)
      i := vec.NEXT(i);  -- Move to next index
   END LOOP;
END;
  • If you are on Oracle 21+, check Oracle patches or try re-running after restarting the database.
发布评论

评论列表(0)

  1. 暂无评论