Bluebelief 2009-06-19 11:28
浏览 300
已采纳

oracle decode函数的问题, 急待解决

我想更新一个表的字段,可是写完报ora-00936缺少表达式,代码贴出来,高手帮着看看,小生感激不尽

update GATHER_STATISTICS t
set BATCH_SUCCESS_COUNT = select decode(cnt, 0,0) as cnt
from ((SELECT count(g.WARNING_TYPE) as cnt
from jk_gather_info_history g
where g.WARNING_TYPE = 0
and g.batch_id = t.batch_id
and t.userid = 2
and g.gather_date >=
to_date('2009-4-7 16:24:24',
'yyyy-mm-dd HH24:MI:SS')
and g.gather_date <=
to_date('2009-4-7 16:24:27',
'yyyy-mm-dd HH24:MI:SS')
group by t.batch_id))
[b]问题补充:[/b]
感谢lovewhzlq的回答,但是还是不行,还是报同样的错误

  • 写回答

5条回答 默认 最新

  • wanghaolovezlq 2009-06-19 11:39
    关注

    update GATHER_STATISTICS t
    set BATCH_SUCCESS_COUNT = select decode([color=red]c.cnt[/color], 0,0) as cnt
    from ((SELECT count(g.WARNING_TYPE) as cnt
    from jk_gather_info_history g
    where g.WARNING_TYPE = 0
    and g.batch_id = t.batch_id
    and t.userid = 2
    and g.gather_date >=
    to_date('2009-4-7 16:24:24',
    'yyyy-mm-dd HH24:MI:SS')
    and g.gather_date <=
    to_date('2009-4-7 16:24:27',
    'yyyy-mm-dd HH24:MI:SS')
    group by t.batch_id))[color=red] c[/color]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝