Question

I need to be able to reconstruct a table column by using the column data in DBA_TAB_COLUMNS, and so to develop this I need to understand what each column refers to. I'm looking to understand what DATA_TYPE_MOD is -- the documentation (http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2094.htm#I1020277) says it is a data type modifier, but I can't seem to find any columns with this field populated or any way to populate this field with a dummy column. Anyone familiar with this field?

Was it helpful?

Solution

Data_type_mod column of the [all][dba][user]_tab_columns data dictionary view gets populated when a column of a table is declared as a reference to an object type using REF datatype(contains object identifier(OID) of an object it points to).

  create type obj as object(
    item number
  ) ;

  create table tb_1(
    col ref obj
  )


  select t.table_name
       , t.column_name
       , t.data_type_mod
   from user_tab_columns t
  where t.table_name = 'TB_1'

Result:

table_name   column_name   data_type_mod
-----------------------------------------
TB_1         COL           REF

OTHER TIPS

Oracle has a PL/SQL package that can be used to generate the DDL for creating a table. You would probably be better off using this.

See GET_DDL on http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414

And see also: How to get Oracle create table statement in SQL*Plus

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top