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

      <legend id='TTjin'><style id='TTjin'><dir id='TTjin'><q id='TTjin'></q></dir></style></legend>

      • <bdo id='TTjin'></bdo><ul id='TTjin'></ul>

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

        Oracle 11g - 使用 RegEx 检查约束

        Oracle 11g - Check constraint with RegEx(Oracle 11g - 使用 RegEx 检查约束)
      1. <tfoot id='OWRwq'></tfoot>
          <bdo id='OWRwq'></bdo><ul id='OWRwq'></ul>
                  <tbody id='OWRwq'></tbody>
              1. <legend id='OWRwq'><style id='OWRwq'><dir id='OWRwq'><q id='OWRwq'></q></dir></style></legend>
                1. <i id='OWRwq'><tr id='OWRwq'><dt id='OWRwq'><q id='OWRwq'><span id='OWRwq'><b id='OWRwq'><form id='OWRwq'><ins id='OWRwq'></ins><ul id='OWRwq'></ul><sub id='OWRwq'></sub></form><legend id='OWRwq'></legend><bdo id='OWRwq'><pre id='OWRwq'><center id='OWRwq'></center></pre></bdo></b><th id='OWRwq'></th></span></q></dt></tr></i><div id='OWRwq'><tfoot id='OWRwq'></tfoot><dl id='OWRwq'><fieldset id='OWRwq'></fieldset></dl></div>

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

                  本文介绍了Oracle 11g - 使用 RegEx 检查约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!


                  我正在使用 Oracle 11g,并尝试创建一个表,定义对创建的约束.

                  I'm using Oracle 11g, and trying to create a table define constraints on the creation.


                  I was trying to add check constraint to validate some information (like e-mail address, phone number, etc...)

                  Oracle 11g 中是否有允许我执行此类操作的内容?

                  Is there something in Oracle 11g that would allow me to do something like this?

                  constraint CK_CONSTRAINT_NAME check (EMAIL like 'REGEX')

                  我想使用的正则表达式(从 regexLib 中抓取)是:

                  The regEx I wanted to use (grabbed from regexLib) is:


                  我认为 Oracle 11g(如果我错了请纠正我)不支持 RegEx 的这种格式...

                  I think Oracle 11g (correct me if I'm wrong) doesn't support this format for RegEx...

                  我见过使用 REGEX_LIKE 的方法,但它似乎只适用于 WHERE 子句.

                  I've seen methods using REGEX_LIKE, but it seems to only work in WHERE clauses.


                  I'd like to keep it as a check constraint and not a trigger or an external function/script.

                  另外,我在这里读过其他主题,有人说 RegEx' 不是验证电子邮件地址格式和此类信息的好方法.评论中没有给出原因,如果有原因,我想知道为什么!

                  Also, I've read in other threads here, someone saying RegEx' are not a good way of verifying e-mail address format and such information. No reason was given in the comment, and I'd like to know why, if a reason there is!


                  检查约束遵循与 WHERE 子句的条件相同的语法规则:

                  A check constraint follows the same syntax rules as conditions for a WHERE clause:

                  alter table foo
                    add constraint check_email 
                    check (REGEXP_LIKE(email,'your_regex_goes_here','I')); 


                  More details in the manual:

                  • 对于 Oracle 11 - http://docs.oracle.com/cd/E11882_01/server.112/e41084/conditions007.htm#SQLRF52141
                  • 对于 Oracle 12 - https://docs.oracle.com/database/121/SQLRF/conditions007.htm#SQLRF52141


                  There are however some restrictions on what you can actually use in a check constraint:

                  • Oracle 11 - http://docs.oracle.com/cd/E11882_01/server.112/e41084/clauses002.htm#SQLRF52205
                  • Oracle 12 - https://docs.oracle.com/database/121/SQLRF/clauses002.htm#SQLRF52205

                  这篇关于Oracle 11g - 使用 RegEx 检查约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



                  Oracle PL/SQL - Raise User-Defined Exception With Custom SQLERRM(Oracle PL/SQL - 使用自定义 SQLERRM 引发用户定义的异常)
                  Oracle: is there a tool to trace queries, like Profiler for sql server?(Oracle:是否有跟踪查询的工具,例如用于 sql server 的 Profiler?)
                  SELECT INTO using Oracle(使用 Oracle SELECT INTO)
                  How to handle Day Light Saving in Oracle database(如何在 Oracle 数据库中处理夏令时)
                  PL/SQL - Use quot;Listquot; Variable in Where In Clause(PL/SQL - 使用“列表Where In 子句中的变量)
                  Oracle: Import CSV file(Oracle:导入 CSV 文件)
                2. <i id='hrjBZ'><tr id='hrjBZ'><dt id='hrjBZ'><q id='hrjBZ'><span id='hrjBZ'><b id='hrjBZ'><form id='hrjBZ'><ins id='hrjBZ'></ins><ul id='hrjBZ'></ul><sub id='hrjBZ'></sub></form><legend id='hrjBZ'></legend><bdo id='hrjBZ'><pre id='hrjBZ'><center id='hrjBZ'></center></pre></bdo></b><th id='hrjBZ'></th></span></q></dt></tr></i><div id='hrjBZ'><tfoot id='hrjBZ'></tfoot><dl id='hrjBZ'><fieldset id='hrjBZ'></fieldset></dl></div>

                    <tfoot id='hrjBZ'></tfoot>
                      <tbody id='hrjBZ'></tbody>

                          • <bdo id='hrjBZ'></bdo><ul id='hrjBZ'></ul>
                            <legend id='hrjBZ'><style id='hrjBZ'><dir id='hrjBZ'><q id='hrjBZ'></q></dir></style></legend>

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