Home » SQL & PL/SQL » SQL & PL/SQL » column with data_type CLOB does not appear in user_ind_columns, why?
column with data_type CLOB does not appear in user_ind_columns, why? [message #653060] Sat, 25 June 2016 08:32 Go to next message
gunderj
Messages: 17
Registered: April 2016
Location: California
Junior Member
If you create a table with a column data_type of CLOB you will get an index of index_type LOB but somehow the column does not appear in user_ind_columns. Does anyone know why, or where else I could find the column in the dictionary? Thanks.

create table t(
x1 number,
x2 clob)
/

select table_name,index_name,index_type from user_indexes 
where index_type = 'LOB'
/

select column_name from user_ind_columns
where column_name = 'X2'
/
Re: column with data_type CLOB does not appear in user_ind_columns, why? [message #653061 is a reply to message #653060] Sat, 25 June 2016 08:40 Go to previous messageGo to next message
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
Try: select * from user_indexes where table_name = 'T';

SQL> r
  1* SELECT index_name, index_type, table_name FROM user_indexes WHERE table_name = 'T'

INDEX_NAME                     INDEX_TYPE                  TABLE_NAME
------------------------------ --------------------------- ------------------------------
SYS_IL0000074565C00002$$       LOB                         T

It's not associated with the column, but with the lob segment created for the column. Hence, no data in user_ind_columns.
Re: column with data_type CLOB does not appear in user_ind_columns, why? [message #653062 is a reply to message #653061] Sat, 25 June 2016 09:03 Go to previous messageGo to next message
gunderj
Messages: 17
Registered: April 2016
Location: California
Junior Member
Yes, but if you cannot find a column in user_ind_columns (that does show up in a describe of the table), then this is a serious hole in the dictionary and a show-stopper for certain applications. I was hoping that the column_name might be found in some other sys view?
Re: column with data_type CLOB does not appear in user_ind_columns, why? [message #653063 is a reply to message #653062] Sat, 25 June 2016 09:10 Go to previous messageGo to next message
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
You can get the column name from *_LOBS:

SQL> r
  1* SELECT table_name, column_name FROM user_lobs WHERE table_name = 'T'

TABLE_NAME                     COLUMN_NAME
------------------------------ ----------------------------------------
T                              X2
Re: column with data_type CLOB does not appear in user_ind_columns, why? [message #653064 is a reply to message #653063] Sat, 25 June 2016 09:13 Go to previous messageGo to next message
gunderj
Messages: 17
Registered: April 2016
Location: California
Junior Member
That will do it.
Thanks
Re: column with data_type CLOB does not appear in user_ind_columns, why? [message #653066 is a reply to message #653064] Sat, 25 June 2016 09:39 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

In addition to Frank's answer:
SQL> select table_name,index_name,index_type from user_indexes
  2  where index_type = 'LOB' and table_name ='T'
  3  /
TABLE_NAME                     INDEX_NAME                     INDEX_TYPE
------------------------------ ------------------------------ ---------------------------
T                              SYS_IL0000162200C00002$$       LOB

SQL> select column_name, index_name from user_lobs
  2  where table_name = 'T'
  3  /
COLUMN_NAME                    INDEX_NAME
------------------------------ ------------------------------
X2                             SYS_IL0000162200C00002$$
So USER_LOBS contains the index and column names and can be seen, for your question, as USER_IND_COLUMNS for other index types.

Re: column with data_type CLOB does not appear in user_ind_columns, why? [message #653067 is a reply to message #653064] Sat, 25 June 2016 10:55 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3273
Registered: January 2010
Location: Connecticut, USA
Senior Member
LOB index is not a regular index. It is index of chunks that make up the LOB.

SY.
Re: column with data_type CLOB does not appear in user_ind_columns, why? [message #653068 is a reply to message #653067] Sat, 25 June 2016 10:57 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Maybe to get the name of the associated column when you have the index name.

Previous Topic: How to prevent trigger from firing on failed insert
Next Topic: Help Creating a Trigger for Reoccuring Events
Goto Forum:
  


Current Time: Fri Apr 26 01:59:24 CDT 2024