PL/SQL Compilation Fails with PLS-00801: Internal Error [Phd_get_defn:Lhs Expr Type] (Doc ID 1368551.1)

Last updated on JULY 05, 2017

Applies to:

PL/SQL - Version: 11.2.0.2 and later   [Release: 11.2 and later ]
Information in this document applies to any platform.

Symptoms

After migrating from 10.2.0.4 to 11.2.0.2 an existing PL/SQL package fails to compile when calling a function as an expression which references a record type.
The error is PLS-00801: internal error [phd_get_defn:LHS expr type].

It can be reproduced with the following code:

drop table tab_pls801;
create table tab_pls801 (org_id number(2), set_of_books_id number(2));
insert into tab_pls801 values(1, 1);
commit;


create or replace package pack_pls801 is
  type rec_pls801 is record(base tab_pls801%rowtype);
  function func_pls801(p_org_id in number) return rec_pls801;
end pack_pls801;
/


create or replace package body pack_pls801 is
  function func_pls801(p_org_id in number) return rec_pls801 is
  l_result rec_pls801;
  begin
    select * into l_result.base from tab_pls801 where org_id = p_org_id;
    return l_result;
  end;
end pack_pls801;
/


create or replace package pack_test is
  set_of_books_id constant number := pack_pls801.func_pls801(1).base.set_of_books_id;
end pack_test;
/


CREATE OR REPLACE PACKAGE body pack_test is
  l_val number := pack_test.SET_OF_BOOKS_ID; -- error
--l_val number := pack_pls801.func_pls801().base.set_of_books_id; -- works
end pack_test;


Warning: Package Body created with compilation errors.

SQL> show errors
Errors for PACKAGE BODY PACK_TEST:

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PLS-00801: internal error [phd_get_defn:LHS expr type]


Changes

Migrate from 10.2.0.5 to 11.1.0.6, 11.1.0.7 or 11.2.0.2.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms