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"><sqlMap><typeAlias type="flex.samples.spring.dao.DailyReportBean" alias="dailyreport"/><resultMap class="dailyreport" id="rltPrintMonthReport"><result property="day" column="day"/><result property="starttime" column="starttime"/><result property="endtime" column="endtime"/><result property="worktime" column="worktime"/><result property="workcontent" column="workcontent"/><result property="department" column="department"/><result property="team" column="team"/><result property="confirm" column="confirm"/></resultMap> <select id="selPrintMonthReport" resultMap="rltPrintMonthReport" parameterClass="dailyreport">select ltrim(substr(report_date,7,2),0) day, min(starttime) starttime, max(endtime) endtime, case when min(starttime)<='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 </select></sqlMap>问题:如粗体红色部分所示,IBATIS中这样写报错.在网上查了一下,除等于外一般用动态SQL这种写法<isGreaterThan prepend=" and " property="??" compareValue="???">问题是我的写在CASE WHEN 语句中,应该怎么样修改....迷茫中...等待大好人....

解决方案

http://www.iteye.com/problems/624这个里面有答案.. 哈哈
解决方案二:
因为这个是xml格式的,所以不允许出现类似“>”这样的字符,但是都可以使用<![CDATA[ ]]>符号进行说明,将此类符号不进行解析你的可以写成这个:<![CDATA[ when min(starttime)<='12:00' and max(endtime)<='12:00' ]]>

时间: 2024-09-20 05:37:19

ibatis sql语句 大于等于号的问题的相关文章

iBatis习惯用的16条SQL语句_java

iBatis 简介: iBatis 是apache 的一个开源项目,一个O/R Mapping 解决方案,iBatis 最大的特点就是小巧,上手很快.如果不需要太多复杂的功能,iBatis 是能够满足你的要求又足够灵活的最简单的解决方案,现在的iBatis 已经改名为Mybatis 了. 官网为:http://www.mybatis.org/ 1.输入参数为单个值 <delete id="com.fashionfree.stat.accesslog.deleteMemberAccessLo

oracle11g-使用sql语句select插入数据时怎么用行号补0为流水号做完单号保存

问题描述 使用sql语句select插入数据时怎么用行号补0为流水号做完单号保存 使用select语句像某个表中插入数据,表的单号要为该语句的ItemCode的值+5位流水号.流水号的规则是查询出来的"RowNum"的值自动补0为5为流水号.怎么出入,查询数据如图 解决方案 新增一列numerical order 类型为字符串 然后写个方法计算numerical order ,insert进去. 但只用sql语句的话,还没想到. 解决方案二: 试试这个: select itemcode

=号附近有语法错误 看来看去都没找到 sql语句没错误呀

问题描述 =号附近有语法错误 看来看去都没找到 sql语句没错误呀 private void button1_Click(object sender, EventArgs e) { string sql = "select count(*) from T_USER where users='" + tb_user.Text.Trim() + "'"; DataSet ds = account.Getdateset(sql); if (ds != null &

登录事件-出现错误说=号附近有语法错误 SQL语句没错呀

问题描述 出现错误说=号附近有语法错误 SQL语句没错呀 private void button1_Click(object sender, EventArgs e) { try { string sql = string.Format("select uname,password,userrole from tb_userinfo where uname='{0}'", this.tb_name.Text.Trim()); DataSet ds = sqlHple.GetDateSe

oracle-搜索功能遇到单引号时报错,怎么在sql语句中转译

问题描述 搜索功能遇到单引号时报错,怎么在sql语句中转译 String list_sql = "select rownum p_index,(select count(*) from tb_user) total,p.user_id,p.user_name,p.user_pwd,p.real_name,p.address," +"p.user_tel,p.isloginm,p.refresh_time,p.role_id,p.login_time,p.note,p.user

sql 插入语句单引号和双引号问题

问题描述 sql 插入语句单引号和双引号问题 ![ 这两句语句都对吗? 解决方案 java拼sql串用双引号,sql语句里用单引号 解决方案二: SQL中的单引号和双引号sql 那些单引号双引号关于SQL 中的单引号和双引号 解决方案三: 双引号那句编译不了,双引号没加上反斜杆注明.

Sql server 数据库中,纯SQL语句查询、执行 单引号问题。

原文:Sql server 数据库中,纯SQL语句查询.执行 单引号问题. 在默认值情况下, select 'abc',Titile from tb_Name;  ---输出内容 是abc: 如果想输出 单引号 'abc,需要使用select '''abc',Titile from tb_Name; ---这里用三个单引号'''abc: select '''abc''',Title from tbName;   输出内容是'abc':两边带有单引号: 谨记:如果字符串包含单引号,则需要在单引号前

在sql语句中截取字符串,处理单引号问题。

问题描述 select*fromTaskInfoWHERE1=1ANDTaskInfoCode='==''=='ANDTaskInfoIDlike'%name%'orderbyTaskInfoCode有这样一个sql语句,如何把查询条件截取出来呢.就是截取'==''=='和'%name%'两部分.还有就是怎么在一个拼写完整的sql语句中处理单引号问题?各位高手帮帮忙! 解决方案 解决方案二:用双引号不行?解决方案三:是想把条件中的单引号换成双引号但是,查询条件本身也有单引号,这个怎么处理呢?解决

iBATIS.net获取运行时sql语句(带参数)

问题描述 获取的SQL语句是SELECT*fromtab_nameWHEREId=:param0andname=:param1希望转成SELECT*fromtab_nameWHEREId='qqqqq'andname='张三'有个人建议是用工具来实现.不过我还是想问下有没其他方式通过代码来获取"Batis打印出来的参数化PreparedSql内部是通过拼接字符串构造SQL语句的,类似于ADO.Net常见的DbCommand里的CommandText,实际执行的SQL语句只能通过数据库工具获取,比