Home » RDBMS Server » Server Administration » find type# and typename relation
find type# and typename relation [message #154768] Tue, 10 January 2006 07:41 Go to next message
raddisonlee
Messages: 29
Registered: March 2005
Junior Member
hi ,can someone show me
find out typename from type#
example 1 stand for table,2 stand for index ........
where to find that relation ??

i get in that trouble for somedays !!!! thanks

[Updated on: Tue, 10 January 2006 07:54]

Report message to a moderator

Re: find type# and typename relation [message #154781 is a reply to message #154768] Tue, 10 January 2006 09:22 Go to previous messageGo to next message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
See the first DECODE in SYS.USER_OBJECTS:
SQL> SELECT av.text
  2  FROM   sys.all_views  av
  3  WHERE  av.owner     = 'SYS'
  4  AND    av.view_name = 'USER_OBJECTS'
  5  /
 
TEXT
--------------------------------------------------------------------------------
select o.name, o.subname, o.obj#, o.dataobj#,
       decode(o.type#, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
                      4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE',
                      7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE',
                      11, 'PACKAGE BODY', 12, 'TRIGGER',
                      13, 'TYPE', 14, 'TYPE BODY',
                      19, 'TABLE PARTITION', 20, 'INDEX PARTITION', 21, 'LOB',
                      22, 'LIBRARY', 23, 'DIRECTORY',  24, 'QUEUE',
                      28, 'JAVA SOURCE', 29, 'JAVA CLASS', 30, 'JAVA RESOURCE',
                      32, 'INDEXTYPE', 33, 'OPERATOR',
                      34, 'TABLE SUBPARTITION', 35, 'INDEX SUBPARTITION',
                      40, 'LOB PARTITION', 41, 'LOB SUBPARTITION',
                      42, 'MATERIALIZED VIEW',
                      43, 'DIMENSION',
                      44, 'CONTEXT', 46, 'RULE SET', 47, 'RESOURCE PLAN',
                      48, 'CONSUMER GROUP',
                      51, 'SUBSCRIPTION', 52, 'LOCATION',
                      55, 'XML SCHEMA', 56, 'JAVA DATA',
                      57, 'SECURITY PROFILE', 59, 'RULE',
                      62, 'EVALUATION CONTEXT',
                     'UNDEFINED'),
       o.ctime, o.mtime,
       to_char(o.stime, 'YYYY-MM-DD:HH24:MI:SS'),
       decode(o.status, 0, 'N/A', 1, 'VALID', 'INVALID'),
       decode(bitand(o.flags, 2), 0, 'N', 2, 'Y', 'N'),
       decode(bitand(o.flags, 4), 0, 'N', 4, 'Y', 'N'),
       decode(bitand(o.flags, 16), 0, 'N', 16, 'Y', 'N')
from sys.obj$ o
where o.owner# = userenv('SCHEMAID')
  and o.linkname is null
  and (o.type# not in (1  /* INDEX - handled below */,
                      10 /* NON-EXISTENT */)
       or
       (o.type# = 1 and 1 = (select 1
                             from sys.ind$ i
                            where i.obj# = o.obj#
                              and i.type# in (1, 2, 3, 4, 6, 7, 9))))
  and o.name != '_NEXT_OBJECT'
  and o.name != '_default_auditing_options_'
union all
select l.name, NULL, to_number(null), to_number(null),
       'DATABASE LINK',
       l.ctime, to_date(null), NULL, 'VALID', 'N', 'N', 'N'
from sys.link$ l
where l.owner# = userenv('SCHEMAID')
 
SQL>
Re: find type# and typename relation [message #154845 is a reply to message #154768] Tue, 10 January 2006 23:41 Go to previous message
raddisonlee
Messages: 29
Registered: March 2005
Junior Member
SQL> select distinct object_type,object_type_id from SYS_OBJECTS ;

OBJECT_TYPE OBJECT_TYPE_ID
------------------ --------------
CLUSTER 3
INDEX 1
INDEX PARTITION 20
LOBINDEX 1
LOBSEGMENT 21
NESTED TABLE 2
TABLE 2
TABLE PARTITION 19

8 rows selected.


i only can take so little message from sys_objects...

why 2 can be opposite to nested table & table !

[Updated on: Wed, 11 January 2006 21:13]

Report message to a moderator

Previous Topic: Oracle 10G gui table partition
Next Topic: Upgrading oracle817 on Compaq Tru64 UNIX 4.0 to Oracle920 on HP11i
Goto Forum:
  


Current Time: Sat Jan 25 09:48:35 CST 2025