[SQL ERROR 800]Corresponding types must be compatible in CASE expression.
SQL应用报错800.Corresponding types must be compatible in CASE expression.
错误描述:
11:00:51 [SELECT - 0 row(s), 0.000 secs] [Error Code: -800, SQL State: IX000] Corresponding types must be compatible in CASE expression.
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]
IBM解释:
Cause
The data types of the THEN and ELSE part are different. For example the THEN part return a date value and the ELSE part return a date/time value.
Environment
Windows
Diagnosing the problem
Check your report for IF/THEN/ELSE expressions.
Resolving the problem
Verify your Impromptu report for IF/THEN/ELSE expressions.
Check the data type of the THEN part with the data type of the ELSE part. Both need to be return the same data type. If not you need to add an additional calculation or a function to transform the result into a result with the required data type.
Exapmle:
IF ( column <> 1 ) THEN ( date ) ELSE ( date + 001 00:00:00:000 )
The THEN part returns a date value (data type: date)
The ELSE part returns a date/time value (data type: date/time)
Modify the above expression into:
IF ( column <> 1 ) THEN ( date + 000 00:00:00:000 ) ELSE ( date + 001 00:00:00:000 )
The THEN part returns a date/time value.
The ELSE part returns a date/time value.
or
IF ( column <> 1 ) THEN ( date ) ELSE ( datetime-to-date ( date + 001 00:00:00:000 ) )
The THEN part returns a date value.
The ELSE part returns a date value.
参见:
http://www-01.ibm.com/support/docview.wss?uid=swg21425745
举例分析:
select unique case when month(statdate) <10 then 0||month(statdate) else ''||month(statdate) end statdate from disxxx
where statdate = '20130731' or statdate = '20121231';
select unique case when month(statdate) <10 then 0||month(statdate) else month(statdate) end statdate from disxxx
where statdate = '20130731' or statdate = '20121231'
0||month(statdate) 这个得到的 是一个字符串
month(statdate) 这个得到的是个 数字。
两个冲突!
[SQL ERROR 800]Corresponding types must be compatible in CASE expression.的更多相关文章
- IBM DB2 SQL error code list
SQL return codes that are preceded by a minus sign (-) indicate that the SQL statement execution was ...
- Slave SQL: Error 'Incorrect string value ... Error_code: 1366
背景: 主从环境一样,字符集是utf8. Slave复制报错,平时复制都正常也没有出现过问题,今天突然报错: :: :: :: :: Error_code: :: perror 1366 MySQL ...
- SQL Error (1130): Host '192.168.1.126' is not allowed to connect to this MySQL server
通过HeidiSQL连接MYSQL数据库报错: SQL Error (1130): Host '192.168.1.126' is not allowed to connect to this MyS ...
- 通过navicat连接mysql服务器提示SQL Error (1130): Host '192.168.1.100' is not allowed to connect to this MySQL server
新装一个mysql,尝试用通过navicat连接mysql服务器的时候提示: SQL Error (1130): Host '192.168.1.100' is not allowed to conn ...
- Sqlite出现SQL error: database disk image is malformed的处理
SQLite有一个很严重的缺点就是不提供Repair命令.导致死亡提示database disk image is malformed它的产生有很多种可能,比如,磁盘空间不足,还有就是写入数据过程中突 ...
- DB2 SQL Error: SQLCODE=-803, SQLSTATE=23505, SQLERRMC=2 (转载)
http://blog.csdn.net/xiyuan1999/article/details/5706230 DB2 SQL Error: SQLCODE=-803, SQLSTATE=23505, ...
- Mysql远程连接报错:SQL Error (1130): Host '192.168.61.128' is not allowed to connect to this MySQL server
Mysql远程连接报错:SQL Error (1130): Host '192.168.0.18' is not allowed to connect to this MySQL server ...
- Oracle Alert - APP-ALR-04108: SQL error ORA-01455
SELECT OD.ORGANIZATION_CODE, TO_CHAR(H.ORDER_NUMBER), --ORACLE ALERT 自动转数字类型最长11位,转字符处理解决APP-ALR-041 ...
- Mysql远程连接报错:SQL Error (1130): Host '192.168.6.128' is not allowed to connect to this MySQL server
通过SQLyog连接linux中的MySQL报错问题:SQL Error (1130): Host '192.168.6.128' is not allowed to connect to this ...
随机推荐
- mongoexport导出csv中文乱码
在用mongoexport导出csv文件时,发现数据库中的中文在excel中都显示为乱码,用notepad打开则正常. 解决办法: 在notepad中,将编码格式改为UTF-8,保存,再用excel打 ...
- OpenLayers 3 之 地图图层数据来源(ol.source)详解
原文地址 source 是 Layer 的重要组成部分,表示图层的来源,也就是服务地址.除了在构造函数中制定外,可以使用 layer.setSource(source) 稍后指定.一.包含的类型 ol ...
- ASP.NET MVC3 Model的常用验证示例
1.金额(10位整数,2位小数) #region 余额 /// <summary> /// 余额 /// </summary> [DisplayName("余额&qu ...
- 不能访问本地服务器场。没有注册带有FeatureDependencyId 的 Cmdlet
不能访问本地服务器场.没有注册带有FeatureDependencyId 的 Cmdlet. 原因: 我有两个域管理员账号,分别:sp\administrator,sp\spadmin 其中后者才 ...
- 创建.symlnk文件
本文转自:https://zhidao.baidu.com/question/1695955535823679548.html 1 2 3 4 5 6 7 8 9 10 11 创建符号链接. MK ...
- Network Principle Course Summary 001
1.物理层 物理层 协议:RJ45.CLOCK.IEEE802.3 (中继器,集线器) 作用:通过媒介传输比特,确定机械及电气规范(比特Bit) 1.1 通信基础 数据 (data) —— 运送消息的 ...
- final修饰的地址不能被修改
package final0; /* * 顾客 */public class Customer { // 属性 String name; int age; // 父类object的方法 public ...
- hdu 2923 map+Floyd 拉破车
有向图 具体方向看箭头 从起点到指定城市拉破车,一个城市可能有多个破车,一次只能拉一辆破车 也就是到了指定地点后要回到起点 假如有100辆破车 但是只有一个城市有 就得在起点与这个城市间往返100次所 ...
- P1387 最大正方形 图DP
题目描述 在一个n*m的只包含0和1的矩阵里找出一个不包含0的最大正方形,输出边长. 输入输出格式 输入格式: 输入文件第一行为两个整数n,m(1<=n,m<=100),接下来n行,每行m ...
- miniblink+golang开发windows gui应用
golang的优点自不必说了,这么好的语言怎么能缺少界面库呢?所以我使用miniblink开发了一个可以用html,css,js开发界面的浏览器,通过它你能为你的golang开发简单的界面.说白了其实 ...