免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2188 | 回复: 8
打印 上一主题 下一主题

ORACLE求救! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-02-27 15:10 |只看该作者 |倒序浏览
select  capital_account from closing.tb_balance a
               where  a.branch_code='0800'
        and   (branch_code,capital_account,currency_code) in
  (select branch_code,capital_account,(case c.market_code when '3' then '1' when '4' then '2' when 'Y' then '2' else '0' end)
               from closing.tb_stock_balance c
               where c.branch_code='0800'
               and   a.capital_account=c.capital_account
))         

执行结果为2041条记录

而通过下面这句话:
create table tkhh_tmp1 as
select  capital_account from closing.tb_balance a
               where  a.branch_code='0800'
        and   (branch_code,capital_account,currency_code) in
  (select branch_code,capital_account,(case c.market_code when '3' then '1' when '4' then '2' when 'Y' then '2' else '0' end)
               from closing.tb_stock_balance c
               where c.branch_code='0800'
               and   a.capital_account=c.capital_account
))         


select count(*) from tkhh_tmp1
结果为84条记录


这是什么问题啊?!!!!!!!

论坛徽章:
0
2 [报告]
发表于 2008-02-27 15:19 |只看该作者
select  capital_account from closing.tb_balance a
               where  a.branch_code='0800'
        and   (branch_code,capital_account,currency_code) in
  (select branch_code,capital_account,(case c.market_code when '3' then '1' when '4' then '2' when 'Y' then '2' else '0' end)
               from closing.tb_stock_balance c
               where c.branch_code='0800'
               and   a.capital_account=c.capital_account
))

最后多了个扩号,不知道你怎么执行出结果的

下面的那个语句是不是少了个左括号?

论坛徽章:
0
3 [报告]
发表于 2008-02-27 15:32 |只看该作者

回复 #2 gthboy 的帖子

不好意思,我多拷了一个右括号.

论坛徽章:
0
4 [报告]
发表于 2008-02-27 15:38 |只看该作者

回复 #1 永远是新手 的帖子

有人碰到过这个问题吗?

论坛徽章:
0
5 [报告]
发表于 2008-02-27 15:43 |只看该作者
我现在闲着,你可以把你这几个表的数据导出dmp传上来,我试验一下吗?

论坛徽章:
0
6 [报告]
发表于 2008-02-27 16:00 |只看该作者
请LZ把完整的原始测试过程(不加任何修改)贴上来。

论坛徽章:
0
7 [报告]
发表于 2008-02-27 16:30 |只看该作者

回复 #1 永远是新手 的帖子

上面的语句就是完整的测试过程.
在我把表进行analyze 后,执行结果就一致了.

论坛徽章:
0
8 [报告]
发表于 2008-02-27 16:31 |只看该作者

回复 #5 gthboy 的帖子

数据量太大了,导出来不合适.

论坛徽章:
0
9 [报告]
发表于 2008-02-27 16:59 |只看该作者
正确结果为84?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP