zoukankan      html  css  js  c++  java
  • 函数索引 ORA30553: The function is not deterministic 解决方法

    建函数索引的时候报错:ORA-30553: The function is not deterministic 这个函数是自定义的。

    SQL>create index mobileIndex on mobile(getmobilearea (callerno));

    Google 一下:

    ORA-30553:

    The function is not deterministic

    Cause:

    The function on which the index is defined is not deterministic

    Action:

    If the function is deterministic, mark it DETERMINISTIC. 

    If it is not deterministic (it depends on package state, database state, current time, or anything other than 

    the function inputs) then do not create the index. The values returned by a deterministic function 

    should not change even when the function is rewritten or recompiled.

     

    解决如下:

    创建基于自定义函数, 指定deterministic参数,在创建函数索引,就没有问题了

    CREATE OR REPLACE FUNCTION ICD.getmobilearea (mobileno VARCHAR2)

       RETURN VARCHAR2 deterministic

    IS

       s   VARCHAR2 (20);

       i   INTEGER;

       c   INTEGER;

    BEGIN

       FOR i IN 4 .. 11

       LOOP

          SELECT COUNT (*)

            INTO c

            FROM mobilearea

           WHERE shortno LIKE SUBSTR (mobileno, 1, i) || '%';

          s := '000';

          IF c = 0

          THEN

             EXIT;

          ELSE

             IF c = 1

             THEN

                SELECT areacode

                  INTO s

                  FROM mobilearea

                 WHERE shortno LIKE SUBSTR (mobileno, 1, i) || '%';

                EXIT;

             END IF;

          END IF;

       END LOOP;

       RETURN s;

    END getmobilearea;

    /

    道森Oracle,国内最早、最大的网络语音培训机构,我们提供专业、优质的Oracle技术培训和服务! 我们的官方网站:http://www.daosenoracle.com 官方淘宝店:http://daosenpx.taobao.com/
  • 相关阅读:
    Oracle中修改表名遇到“ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效”
    zabbix监控华为服务器硬件状态
    基于LLDP和OpenFlow的网络拓扑检测
    应用nslookup命令查看A记录、MX记录、CNAME记录和NS记录
    Dockerfile
    Get Docker CE for CentOS
    前端构建工具gulpjs的使用介绍及技巧
    Error: Cannot find module 'gulp-clone'问题的解决
    oracle 12C wmsys.wm_concat()函数
    Windows实现内网IPMI端口转发
  • 原文地址:https://www.cnblogs.com/tianlesoftware/p/3610173.html
Copyright © 2011-2022 走看看