Display names of all constraints for a table in Or
2014-05-28 00:00
471 查看
You need to query the data dictionary, specifically the USER_CONS_COLUMNS view to see the table columns and corresponding constraints:
FYI, unless you specifically created your table with a lower case name (using double quotes) then the table name will be defaulted to upper case so ensure it is so in your query.
If you then wish to see more information about the constraint itself query the USER_CONSTRAINTS view:
If the table is held in a schema that is not your default schema then you might need to replace the viewws with:
and
adding to the where clause:
Hope it helps...
SELECT * FROM user_cons_columns WHERE table_name = '<your table name>';
FYI, unless you specifically created your table with a lower case name (using double quotes) then the table name will be defaulted to upper case so ensure it is so in your query.
If you then wish to see more information about the constraint itself query the USER_CONSTRAINTS view:
SELECT * FROM user_constraints WHERE table_name = '<your table name>' AND constraint_name = '<your constraint name>';
If the table is held in a schema that is not your default schema then you might need to replace the viewws with:
all_cons_columns
and
all_constraints
adding to the where clause:
AND owner = '<schema owner of the table>'
Hope it helps...
相关文章推荐
- sql: Query to Display Foreign Key Relationships and Name of the Constraint for Each Table in Database
- Get the rows count of all the table in Sybase
- generate a simple class for all fields of a table .
- Use '$' instead of '.' for inner classes (or use only lowercase letters in package names)
- 22.You need to create a table for a banking application. One of the columns in the table has the fol
- groovy Exports all table names in database
- index$_join$ or Other Internal Table Appears in Audit Trail Instead of Base Table. (Doc ID 955968.1)
- Use '$' instead of '.' for inner classes (or use only lowercase letters in package names) 问题
- ORA-14099: all rows in table do not qualify for specified partition
- Performance of Using Keys in SELECT with FOR ALL ENTRIES
- VB6:关于“Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types.”的编译错误
- 解决MYSQL访问时无法切换数据库的问题.Reading table information for completion of table and column names
- The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain.
- Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral or
- Display the size of all tables in Sql Server 2005
- the name or security ID(SID) of the domain specified is inconsistent with the trust information for that domain
- ADF: The best way to indicate for records in a table the existence of details
- Calling sequence for inserting or deleting rows in a table view
- Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect
- ERROR 1269 (HY000): Can't revoke all privileges for one or more of the requested users