Search code examples
oracleoracle11guser-defined-types

Updating User-defined types in Oracle 11G


Is there any way to update part of a user-defined type in Oracle?

Example:

create or replace TYPE MY_TYPE AS OBJECT
(
    VAR_1          NUMBER,
    VAR_2          DATE,
    VAR_3          NUMBER,
    VAR_4          DATE
);

Sample Table:

create TABLE TEST_TABLE
(
    TBL_ID          NUMBER,
    MY_DATA         MY_TYPE
);

Is there any way to do something like the following:

UPDATE TEST_TABLE SET MY_DATA.VAR_3 = 1;

Thanks!


Solution

  • Yes but for some reason you need to alias the table:

    UPDATE TEST_TABLE T SET T.MY_DATA.VAR_3 = 1;