I'm trying to save a few Java collections in Oracle PL/SQL stored procedure.
Does anyone know, if there is a way to create Oracle type of the same structure as an existing Oracle table? I would like to avoid creating a lot of CREATE OR REPLACE TYPE t_row AS OBJECT(...);
, then CREATE OR REPLACE TYPE t_list AS TABLE OF t_row;
for each Java collection.
In other words I would like to create something like:
CREATE OR REPLACE TYPE typename AS TABLE OF schema.existing_table;
I was trying to find some information over the web and it seems like there aren't any similar topics.
Any hint would be very much appreciated.
Does the type need to be a SQL type? If you're OK with a PL/SQL type, you can declare a collection of
%ROWTYPE
records. Presumably, you'd create the types in one or more packages and then use them wherever appropriate.