维斯 ๑ 2008-06-25 10:35
浏览 479
已采纳

ibatis sql语句 大于等于号的问题

刚接触IBATIS,希望大家能够帮忙看一下.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap

PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-2.dtd">














select ltrim(substr(report_date,7,2),0) day,
min(starttime) starttime,
max(endtime) endtime,
case
when min(starttime)[color=red][b]<=[/b][/color]'12:00' and max(endtime)<='12:00'
then (to_date(max(endtime),'hh24:mi')-to_date(min(starttime),'hh24:mi'))*24
when (min(starttime)>='12:00' and min(starttime)<='13:00') and (max(endtime)>='12:00' and max(endtime)<='13:00')
then 0
when min(starttime)>='13:00' and max(endtime)>='13:00'
then (to_date(max(endtime),'hh24:mi')-to_date(min(starttime),'hh24:mi'))*24
when min(starttime)<='12:00' and (max(endtime)>='12:00' and max(endtime)<='13:00')
then (to_date('12:00','hh24:mi')-to_date(min(starttime),'hh24:mi'))*24
when min(starttime)<='12:00' and max(endtime)>='13:00'
then (to_date(max(endtime),'hh24:mi')-to_date(min(starttime),'hh24:mi'))*24-1
when (min(starttime)>='12:00' and min(starttime)<='13:00') and max(endtime)>='13:00'
then (to_date(max(endtime),'hh24:mi')-to_date('13:00','hh24:mi'))*24
end worktime,
report_date,substr(max(sys_connect_by_path(workcontent,',')),2) workcontent,
max(department) department,
max(team) team,
max(confirm) confirm
from (select dailyreport.*,row_number() over(partition by report_date order by workcontent) rn from dailyreport)
where login_id=#loginid# and substr(report_date,0,6)=#reportdate#
group by report_date
start with rn=1
connect by rn-1=prior rn and report_date=prior report_date

问题:
如粗体红色部分所示,IBATIS中这样写报错.在网上查了一下,除等于外一般用动态SQL这种写法
问题是我的写在CASE WHEN 语句中,应该怎么样修改....迷茫中...等待大好人....

  • 写回答

2条回答 默认 最新

  • lggegegmail 2008-06-25 11:21
    关注

    http://www.iteye.com/problems/624

    这个里面有答案.. 哈哈

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

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大