表a
本身id id
上级id parentid
类别 type
操作id oprid现在操作id这一列都是空,要更新一下。
如果某条记录中type=3,则将oprid更新为id(没有上级的,type一定为3)
如果记录中type不是3,则要通过树递归查询到上级的id(离子节点最近的一个父节点且type=3的),将这里查询到的id更新到oprid最后更新后得到下面这样的结果id parentid type oprid
1 - 3 1
2 1 3 2
3 2 2 2
4 3 2 2
5 2 3 5
6 5 2 5
本身id id
上级id parentid
类别 type
操作id oprid现在操作id这一列都是空,要更新一下。
如果某条记录中type=3,则将oprid更新为id(没有上级的,type一定为3)
如果记录中type不是3,则要通过树递归查询到上级的id(离子节点最近的一个父节点且type=3的),将这里查询到的id更新到oprid最后更新后得到下面这样的结果id parentid type oprid
1 - 3 1
2 1 3 2
3 2 2 2
4 3 2 2
5 2 3 5
6 5 2 5
解决方案 »
- 求教ORA-00604: 递归 SQL 级别 1 出现错误
- Mandriva2009上安装oracle10g问题
- 急!如何将.dbf文件导入到oracle?
- 如何利用存储过程返回数据集?
- 关于条件表达式字符串整表更新的问题
- 100分题: win2003 sp2,安装ora817 无法建库的问题
- 怎么能够授予用户授权的权限
- 启动oms时提示错误:没有搜索到数据库。??????
- ORACLE中报:maximum number of processes (50) exceeded
- SqlSerVer存储过程转Oracle求各位大神指教!!!!!!
- 重启电脑后oracle启动无效
- 关于PL/SQL Developer与net服务名的问题
update tba a
set oprid=(case type when 3 then id
else (select parentid from tba
where connect_by_isleaf=1 and connect_by_root(id)=a.id
start with type<>3
connect by id=prior parentid and type<>3)
end)
/
1 update tba a
2 set oprid=(case type when 3 then id
3 else (select parentid from tba
4 where connect_by_isleaf=1 and connect_by_root(id)=a.id
5 start with type<>3
6 connect by id=prior parentid and type<>3)
7* end)
SQL> select * from tba
2 / ID PARENTID TYPE OPRID
---------- ---------- ---------- ----------
1 3 1
2 1 3 2
3 2 2 2
4 3 2 2
5 2 3 5
6 5 2 56 rows selected.
我这会报ORA-00600:内部错误代码,参数:[qctcte1],[0],[],[],[],[],[],[]
这是什么原因
http://dev.csdn.net/htmls/52/52618.html