解决方案 »
- 存储过程/函数中对查询条件的判断处理
- oracle使用exp导出文件出现错误,求解?
- 求一条 oracle 动态创建数据表的存储过程
- 如何利用存储过程返回数据集?
- 请问同表内,不同记录间不同字段的比较问题,谢谢!
- 这个oracle操作第三步是什么意思啊,我应该怎么操作啊
- 请教一个SQL问题!!!!!!!!!!!!!
- 这样的查询怎么样写
- 用ADO调用一个存储过程来插入一个blob型数据,关于参数类型的问题,请大家来讨论!
- 急求在一个表请用一条sql语句查出所有的数据,查询结果先按照指定用户类型排序,然后按照id升序排序
- 为什么我的存储过程 都说 是带有编译错误 ,应该怎样解决
- 在oracle中,创建的过程带有编译错误,这是什么原因
from
(select col2,
substr(sys_connect_by_path(col3,','),2) aa
from test1
where CONNECT_BY_ISLEAF=1
start with col1='a'
connect by col1= prior col2)
想了办法'1'||sys_connect_by_path(col3,',')||',' into :string 后分解字符串进行乘积
with tbl as
(
select 'a' as col1, 'b1' as col2, 1 as col3 from dual
union all
select 'a' as col1, 'b2' as col2, 0.5 as col3 from dual
union all
select 'b1' as col1, 'c1' as col2, 0.7 as col3 from dual
union all
select 'b2' as col1, 'c2' as col2, 2 as col3 from dual
)
select col2,
dbms_aw.eval_number(1 || SYS_CONNECT_BY_PATH(trim(to_char(col3,'99999990.99')),'*')) as inum
from tbl t
where connect_by_isleaf = 1
connect by prior col2 = col1
start with col1 = 'a';
COL2 INUM
---- ----------
c1 0.7
c2 1
with temp_table as
(
select 'a' as col1, 'b1' as col2, 1 as col3 from dual
union all
select 'a' as col1, 'b2' as col2, 0.5 as col3 from dual
union all
select 'b1' as col1, 'c1' as col2, 0.7 as col3 from dual
union all
select 'b2' as col1, 'c2' as col2, 2 as col3 from dual
)select t1.col2,(t1.col3*t2.col3)
from temp_table t1,
temp_table t2
where t1.col1 = t2.col2--结果
c1 0.7
c2 1
with tbl as
(
select 'a' as col1, 'b1' as col2, 2 as col3 from dual
union all
select 'a' as col1, 'b2' as col2, 0.5 as col3 from dual
union all
select 'b1' as col1, 'c1' as col2, 0.7 as col3 from dual
union all
select 'b2' as col1, 'c2' as col2, 2 as col3 from dual
union all
select 'c1' as col1, 'd1' as col2, 0.8 as col3 from dual
)
select col2,
dbms_aw.eval_number(1 || SYS_CONNECT_BY_PATH(trim(to_char(col3,'99999990.99')),'*')) as inum
from tbl
where connect_by_isleaf = 1
start with col1 = 'a' connect by prior col2 = col1;
把我的脚本改一下 connect by 的位置就来蒙分?
这样,如果是两级就可以,但子节点一多就不行了,可以往这个方向想想..