Issue
We can use record_name.field% type to reference a field's type...
But if field is a collection (table of ...) the %type is the collection type.
is there a way with %TYPE or something like it to reference the collection element type?
declare
type rec1_t is record (
n1 integer
);
type rec1_tab_t is table of rec1_t;
type rec2_t is record (
x rec1_tab_t
);
x1 rec2_t;
x2 x1.x%type;
begin
null;
end;
/
So in this case x2 is of type rec1_tab_t.
I want something that given the variables, reference the element's type of rec1_tab_t, i.e., rec1_t. Using something like:
declare
x2 x1.x(1)%type
Solution
Sorry, AFAIK there is no way to reference a collection's element type in Oracle's PL/SQL.
The usage of %TYPE and %ROWTYPE attributes is defined in Oracle Database Documentation, book "Database PL/SQL Language Reference" see version 19c here https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/index.html
Answered By - Stoyan Ivanov Answer Checked By - Katrina (sql.easybugfix Volunteer)
Post a Comment
Post a Comment