sql查询报错:[Err] ORA-00913: too many values怎么解决
本篇内容介绍了“sql查询报错:[Err] ORA-00913: too many values怎么解决”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
查询sql:
SELECT * from T_QL_CASE q where q.CASE_OID IN( select f.CASE_OID,f.FINAL_STATUS from T_QL_CASE_APPROVAL_FINAL f where FINAL_STATUS='2' OR FINAL_STATUS='33' OR FINAL_STATUS='43' OR FINAL_STATUS='34' OR FINAL_STATUS='5');
问题原因:
SELECT * from T_QL_CASE q
where q.CASE_OID IN(
select f.CASE_OID,f.FINAL_STATUS
from T_QL_CASE_APPROVAL_FINAL f
where FINAL_STATUS='2'
OR FINAL_STATUS='33'
OR FINAL_STATUS='43'
OR FINAL_STATUS='34'
OR FINAL_STATUS='5');
两个红色的地方,where后面的列数应该和 in(select cloum1,clounm2)中select的列数相同。
当INSERT报这个错误时,一般是插入数据的列数不一致。
原sql: insert into abc.employees select * from employees where employee_id=100; 报错: Error starting at line 1 in command: insert into abc.employees select * from employees where employee_id=100; Error at Command Line:1 Column:25 Error report: SQL Error: ORA-00913: too many values 00913. 00000 - "too many values" *Cause: *Action: 解决办法::: 应按如下所示指定列名称 insert into abc.employees (col1,col2) select col1,col2 from employees where employee_id=100; 如果employees有112列(原文如此!)尝试在下面运行以选择比较两个表的列 select * from ALL_TAB_COLUMNS ATC1 left join ALL_TAB_COLUMNS ATC2 on ATC1.COLUMN_NAME = ATC1.COLUMN_NAME and ATC1.owner = UPPER('2nd owner') where ATC1.owner = UPPER('abc') and ATC2.COLUMN_NAME is null AND ATC1.TABLE_NAME = 'employees' 然后您应该将表升级为具有相同的结构
“sql查询报错:[Err] ORA-00913: too many values怎么解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!