• <i id='dSmfh'><tr id='dSmfh'><dt id='dSmfh'><q id='dSmfh'><span id='dSmfh'><b id='dSmfh'><form id='dSmfh'><ins id='dSmfh'></ins><ul id='dSmfh'></ul><sub id='dSmfh'></sub></form><legend id='dSmfh'></legend><bdo id='dSmfh'><pre id='dSmfh'><center id='dSmfh'></center></pre></bdo></b><th id='dSmfh'></th></span></q></dt></tr></i><div id='dSmfh'><tfoot id='dSmfh'></tfoot><dl id='dSmfh'><fieldset id='dSmfh'></fieldset></dl></div>

    <tfoot id='dSmfh'></tfoot>

          <bdo id='dSmfh'></bdo><ul id='dSmfh'></ul>

        <small id='dSmfh'></small><noframes id='dSmfh'>

      1. <legend id='dSmfh'><style id='dSmfh'><dir id='dSmfh'><q id='dSmfh'></q></dir></style></legend>

        在 Oracle SQL 中显示表的所有约束的名称

        时间:2023-09-18
          <bdo id='ISDHP'></bdo><ul id='ISDHP'></ul>

                <tbody id='ISDHP'></tbody>

              <tfoot id='ISDHP'></tfoot>
              <legend id='ISDHP'><style id='ISDHP'><dir id='ISDHP'><q id='ISDHP'></q></dir></style></legend>
              • <small id='ISDHP'></small><noframes id='ISDHP'>

                1. <i id='ISDHP'><tr id='ISDHP'><dt id='ISDHP'><q id='ISDHP'><span id='ISDHP'><b id='ISDHP'><form id='ISDHP'><ins id='ISDHP'></ins><ul id='ISDHP'></ul><sub id='ISDHP'></sub></form><legend id='ISDHP'></legend><bdo id='ISDHP'><pre id='ISDHP'><center id='ISDHP'></center></pre></bdo></b><th id='ISDHP'></th></span></q></dt></tr></i><div id='ISDHP'><tfoot id='ISDHP'></tfoot><dl id='ISDHP'><fieldset id='ISDHP'></fieldset></dl></div>
                  本文介绍了在 Oracle SQL 中显示表的所有约束的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我为在 Oracle SQL 中创建的多个表的每个约束定义了一个名称.

                  I have defined a name for each of the constraint for the multiple tables that I have created in Oracle SQL.

                  问题是要删除特定表的列的约束,我需要知道我为每个约束提供的名称,但我已经忘记了.

                  The problem is that to drop a constraint for the column of a particular table I need to know the name that I have supplied for each constraints, which I have forgotten.

                  如何列出我为表的每一列指定的所有约束名称?

                  How do I list out all the names of constraints that I have specified for each column of a table?

                  是否有任何 SQL 语句可以执行此操作?

                  Is there any SQL statement for doing so?

                  推荐答案

                  需要查询数据字典,特别是USER_CONS_COLUMNS视图查看表列和对应的约束:

                  You need to query the data dictionary, specifically the USER_CONS_COLUMNS view to see the table columns and corresponding constraints:

                  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.

                  如果您希望查看有关约束本身的更多信息,请查询 USER_CONSTRAINTS 视图:

                  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 views with:

                  all_cons_columns
                  

                  all_constraints
                  

                  添加到 where 子句:

                  adding to the where clause:

                     AND owner = '<schema owner of the table>'
                  

                  这篇关于在 Oracle SQL 中显示表的所有约束的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Liquibase 锁 - 原因? 下一篇:如何在 Oracle 中获取主键列?

                  相关文章

                  <legend id='9PlYu'><style id='9PlYu'><dir id='9PlYu'><q id='9PlYu'></q></dir></style></legend>
                    <bdo id='9PlYu'></bdo><ul id='9PlYu'></ul>

                  <tfoot id='9PlYu'></tfoot>

                  <small id='9PlYu'></small><noframes id='9PlYu'>

                    1. <i id='9PlYu'><tr id='9PlYu'><dt id='9PlYu'><q id='9PlYu'><span id='9PlYu'><b id='9PlYu'><form id='9PlYu'><ins id='9PlYu'></ins><ul id='9PlYu'></ul><sub id='9PlYu'></sub></form><legend id='9PlYu'></legend><bdo id='9PlYu'><pre id='9PlYu'><center id='9PlYu'></center></pre></bdo></b><th id='9PlYu'></th></span></q></dt></tr></i><div id='9PlYu'><tfoot id='9PlYu'></tfoot><dl id='9PlYu'><fieldset id='9PlYu'></fieldset></dl></div>