整理一下自己遇见过的 SQL 各种报错信息及相应解决方法,方便以后查阅,主要平台为 Oracle:
ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值:
- 原因:插入操作时,数据大于字段设定大小,Oracle 会自动将数据转为 long 型,然后报插入失败错误。
- 解决:更改数据大小,或者将字段设为 clob 或 blob 类型。
"ORA-01012: not logged on" 以及 "Connected to an idle instance":
ORA-00913: 值过多:
ORA-01791:不是SELECTed表达式错误:
- 原因:用 select 查询语句时,若同时使用distinct去重与order by排序,就会报该错误,如
select distinct a from table1 where ... order by b;
这是因为 order by 根据 b 列排序时与 distinct 产生冲突,distinct 找不到 b 列。
- 解决:查询列中添加b列,即:
select distinct a,b from table1 where ... order by b;
原标题:SQL 报错信息整理及解决方案(持续更新)
关键词:sql