Decode column position : user_ind_columns « System Tables Views « Oracle PL / SQL

Oracle PL / SQL
1. Aggregate Functions
2. Analytical Functions
3. Char Functions
4. Constraints
5. Conversion Functions
6. Cursor
7. Data Type
8. Date Timezone
9. Hierarchical Query
10. Index
11. Insert Delete Update
12. Large Objects
13. Numeric Math Functions
14. Object Oriented Database
15. PL SQL
16. Regular Expressions
17. Report Column Page
18. Result Set
19. Select Query
20. Sequence
21. SQL Plus
22. Stored Procedure Function
23. Subquery
24. System Packages
25. System Tables Views
26. Table
27. Table Joins
28. Trigger
29. User Previliege
30. View
31. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL / SQL » System Tables Views » user_ind_columns 
Decode column position
   
SQL>
SQL>
SQL> column table_name format a15 word_wrapped
SQL> column index_name format a25 word_wrapped
SQL> column columns format a40
SQL>
SQL> break on table_name skip 1
SQL>
SQL> select table_name,
  2       index_name,
  3  rtrim(
  4       maxdecodecolumn_position, 1, column_name, '' ) )||','||
  5       maxdecodecolumn_position, 2, column_name, '' ) )||','||
  6       maxdecodecolumn_position, 3, column_name, '' ) )||','||
  7       maxdecodecolumn_position, 4, column_name, '' ) )||','||
  8       maxdecodecolumn_position, 5, column_name, '' ) )||','||
  9       maxdecodecolumn_position, 6, column_name, '' ) )||','||
 10       maxdecodecolumn_position, 7, column_name, '' ) )||','||
 11       maxdecodecolumn_position, 8, column_name, '' ) )||','||
 12       maxdecodecolumn_position, 9, column_name, '' ) )||','||
 13       maxdecodecolumn_position, 10, column_name, '' ) )||','||
 14       maxdecodecolumn_position, 11, column_name, '' ) )||','||
 15       maxdecodecolumn_position, 12, column_name, '' ) )||','||
 16       maxdecodecolumn_position, 13, column_name, '' ) )||','||
 17       maxdecodecolumn_position, 14, column_name, '' ) )||','||
 18       maxdecodecolumn_position, 15, column_name, '' ) )||','||
 19       maxdecodecolumn_position, 16, column_name, '' ) )',' )
 20       columns
 21  from user_ind_columns
 22  where rownum < 50
 23  group by table_name,index_name
 24  /
TABLE_NAME      INDEX_NAME                COLUMNS
--------------- ------------------------- ----------------------------------------
EMP_CHANGES     SYS_C005784               MSGID

UPPER_ENAME     SYS_IOT_TOP_15816         X$ENAME,X$RID

DEPT_AND_EMP    SYS_C005826               DEPTNO
                SYS_C005827               EMPS

AQ$_EMP_CHANGES SYS_IOT_TOP_16251         MSGID,SUBSCRIBER#,NAME,ADDRESS#
_G

TABLE_NAME      INDEX_NAME                COLUMNS
--------------- ------------------------- ----------------------------------------


AQ$_EMP_CHANGES SYS_IOT_TOP_16249         MSGID,SUBSCRIBER#,NAME,ADDRESS#
_H


AQ$_EMP_CHANGES SYS_IOT_TOP_16254         SUBSCRIBER#,NAME,QUEUE#,MSG_PRIORITY,MSG
_I                                        _ENQ_TIME,MSG_STEP_NO,MSG_CHAIN_NO,MSG_L
                                          OCAL_ORDER_NO,MSGID



TABLE_NAME      INDEX_NAME                COLUMNS
--------------- ------------------------- ----------------------------------------
AQ$_EMP_CHANGES SYS_C005787               SUBSCRIBER_ID
_S


AQ$_EMP_CHANGES SYS_IOT_TOP_16247         NEXT_DATE,TXN_ID,MSGID
_T


COMPILE_SCHEMA_ COMPILE_SCHEMA_TMP_PK     OBJECT_NAME,OBJECT_TYPE
TMP


10 rows selected.

SQL>

   
    
  
Related examples in the same category
1. Query user_indexes and user_ind_columns table
2. user_indexes join user_ind_columns ic using (table_name,index_name)
3. Check index column and contraints for just created table
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.