Displaying the constraints in a table

南笙酒味 提交于 2019-12-01 03:24:44
Jeff Hunter
select dbms_mview.get_ddl('TABLE',USER,'TEAMS') from dual;

Try this:

SELECT constraint_name, 
       constraint_type,
       search_condition
  FROM USER_CONSTRAINTS
 WHERE table_name = 'TEAMS';

Unless double-quoted when created, all object names in Oracle are upper case.

I personally use:

SELECT * FROM all_constraints WHERE Table_Name = <TableName>;
user3444871

Use the following code:

show create table table_name;

If you prefer the CamelCase names, your create table script should have been:

Create table "Teams" ( 
  "TeamID" varCHAR2(4) constraint "Teams_TeamID_PK" Primary Key, 
  "TeamName" VARCHAR2(40)  
); 

Without double-quotes Oracle helpfully converts all identifiers to uppercase :)

Rahul Kharche

Type the table name in upper case in where clause within the single quotes.

e.g. WHERE table_name = 'TEAMS';

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!