Pages

Wednesday, January 18, 2017

DQL to retrieve all the non inherited attributes of an object type

How to retrieve all the attributes, including both the inherited and not inherited ones, of an object type? The quick way is to use DQL:

select * from dm_type  where  name='testtype' ENABLE(ROW_BASED);

If only the personal attributes without the inherited attributes are needed, the DQL should be slightly elaborated to exclude the inherited attributes:

select * from dm_type  where  name='testtype' and attr_identifier>start_pos order by attr_name ENABLE(ROW_BASED);

Obviously, one would need to replace * with the list of the needed columns, most probably such as attr_name, attr_type, attr_repeating and attr_length.

6 comments:

  1. check following case:

    Connected to Documentum Server running Release 7.3.0000.0214 Linux64.Oracle
    1> create type xxx (a1 string(10)) with supertype null
    2> go
    new_object_ID
    ----------------
    03029886800001f8
    (1 row affected)
    1> create type yyy (a2 string(10)) with supertype xxx
    2> go
    new_object_ID
    ----------------
    03029886800001f9
    (1 row affected)
    1> alter type xxx add a3 string(10)
    2> go
    object_altered
    --------------
    1
    (1 row affected)
    1> select attr_name from dm_type
    2> where name='yyy' and attr_identifier>start_pos
    3> enable(ROW_BASED)
    4> go
    attr_name
    ----------------------------------------
    a3


    the correct query is:

    1> select attr_name from dm_type
    2> where name='yyy' and i_position < -1 * start_pos
    3> enable(ROW_BASED)
    4> go
    attr_name
    ----------------------------------------
    a2
    (1 row affected)

    ReplyDelete