oracle数据库sql递归错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle数据库sql递归错误相关的知识,希望对你有一定的参考价值。

EXP-00056: ORACLE error 604 encounteredORA-00604: error occurred at recursive SQL level 1ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","DATABASE","sga heap(1,0)","kglsim heap")ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","AUDSES$","sga heap(1,0)","kglsim heap")

参考技术A 共享内存不够了,扩一下吧

使用Oracle数据库的递归查询语句生成菜单树

SQL 格式

SELECT * FROM TABLE WHERE [...结果过滤语句]
START WITH [...递归开始条件]
CONNECT BY PRIOR [...递归执行条件]

 

查询所有下级

SELECT * FROM TABLE
START WITH [ID in (‘1‘,‘2‘)]
CONNECT BY PRIOR [ID = ParentId]

 

查询所有上级

SELECT * FROM TABLE
START WITH [ID in (‘1‘,‘2‘)]
CONNECT BY PRIOR [ParentId = ID ]

 

注意:若出现重复项,可以使用 DISTINCT 进行去重

 

实例

<!-- SQL -->
<select id="getReportGroupTree" resultMap="SysFunctionRm">
    select
    distinct "ID", "FUNCTION_NAME", "ICON", "FUNCTION_URL", "EXPLAINATION", "IS_DISABLED", "PARENT_FUNCTION_ID",
    "ORDER_CODE", "ORDE_RHIERARCHY_CODE", "SYSTEM_ID", "IS_DEFAULT", "IS_NEW_WIN", "FUNCTION_CODE", "FUNCTION_TYPE",
    "PRINT_SCHEME", "FUNCTION_MODE", "IS_PRINT"
    from SYS_FUNCTION WHERE function_Type = 2
    start with
    ID In
    <foreach collection="reportGroupIds" item="id" open="(" close=")" separator="," index="index">
        #{id}
    </foreach>
    connect by prior PARENT_FUNCTION_ID=ID
</select>

 

 

以上是关于oracle数据库sql递归错误的主要内容,如果未能解决你的问题,请参考以下文章

递归sql级别1出现错误

ORACLE数据库导表的时候,出现IMP-00017: 由于 ORACLE 错误 604:递归SQL级别1出现错误

在oracle数据库中,想要删除一个用户,但是报递归SQL级别1出现错误,表或视图不存在,请问有办法解决吗?

oracle 10g 删除用户时提示ORA-00604 :递归SQL级别 1

简单几招捕获Oracle递归SQL调用源头

自引用表上的 SQL 递归查询 (Oracle)