[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 ...
随机推荐
- jquery.form.js 让表单提交更优雅
jquery.form.js 让表单提交更优雅.可以页面不刷新提交表单,比jQuery的ajax提交要功能强大. 1.引入 <script src="/src/jquery-1.9.1 ...
- Install Shield中调用devcon自动安装硬件驱动程序
1.安装驱动程序命令devcon安装好WINDDK之后,devcon.exe在"C:\WINDDK\3790.1830\tools\devcon"目录下.>devcon up ...
- 搜索引擎ElasticSearchV5.4.2系列三之ES使用
相关博文: 搜索引擎ElasticSearchV5.4.2系列一之ES介绍 搜索引擎ElasticSearchV5.4.2系列二之ElasticSearchV5.4.2+kibanaV5.4.2+x- ...
- Jenkins与代码上线解决方案
Jenkins是一个用Java编写的开源的持续集成工具.在与Oracle发生争执后,项目从Hudson项目独立. Jenkins提供了软件开发的持续集成服务.它运行在Servlet容器中(例如Apac ...
- jquery实现模拟select下拉框效果
<IGNORE_JS_OP style="WORD-WRAP: break-word"> <!DOCTYPE html PUBLIC "-//W3C// ...
- Android 6.0 变更
Android 6.0(API 级别 23)除了提供诸多新特性和功能外,还对系统和 API 行为做出了各种变更.本文重点介绍您应该了解并在开发应用时加以考虑的一些主要变更. 如果您之前发布过 Andr ...
- 【Android】隐藏底部虚拟按键
Google的官方文档是: https://developer.android.com/training/system-ui/navigation.html#behind 示例代码 1 View de ...
- .NetCore Cap 注册 Consul 服务发现
注册服务发现 需要使用Cap中的UseDiscovery方法 具体用法如下 var capConsulConfig = Configuration.GetSection("CapConsul ...
- net mvc webapi 实用
asp.net mvc webapi 实用的接口加密方法 在很多项目中,因为webapi是对外开放的,这个时候,我们就要得考虑接口交换数据的安全性. 安全机制也比较多,如andriod与webap ...
- 谈谈MySQL中的降序索引 order by id DESC / ASC
今天这篇主要讲order by 语句中的多个字段asc desc的问题.mysql5中,索引存储的排序方式是ASC的,没有DESC的索引.现在能够理解为啥order by 默认是按照ASC来排序的了吧 ...