I’ve got the following type:
create or replace type autocontrole2.DifferentStatesSAC as object (
AUTOCONTROLE_STATUS_CODE_ID NUMBER(2),
DATUM_BEGIN DATE,
DATUM_EIND DATE)
With the following SQL, the error is “ORA 06531 – reference to uninitialized collection”
declare
type TableDifferentStatesSAC is table of autocontrole2.DifferentStatesSAC;
StatutenSAC TableDifferentStatesSAC;
begin
StatutenSAC(1).AUTOCONTROLE_STATUS_CODE_ID := 6;
StatutenSAC(1).DATUM_BEGIN := sysdate;
StatutenSAC(1).DATUM_EIND := sysdate;
end;
With the following SQL, the error is “wrong number of types or arguments in call to DifferentStatesSAC()”:
declare
type TableDifferentStatesSAC is table of autocontrole2.DifferentStatesSAC;
StatutenSAC TableDifferentStatesSAC := autocontrole2.DifferentStatesSAC;
begin
StatutenSAC(1).AUTOCONTROLE_STATUS_CODE_ID := 6;
StatutenSAC(1).DATUM_BEGIN := sysdate;
StatutenSAC(1).DATUM_EIND := sysdate;
end;
I want to create a ‘table’ in memory that contains an object with 3 values.
any ideas how I can add objects to this table?
You need to initialize the nested table:
You can also fill the table with a single command:
Find out more in the online documentation.