oracle ORA-00913: 值太多
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14608953/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ORA-00913: too many values
提问by Ganesan S
getting ORA-00913:
too many values. don't know how to resolve this issue please anyone could help me?
获取ORA-00913:
太多值。不知道如何解决这个问题,请有人可以帮助我吗?
con2 = DriverManager.getConnection("Jdbc:Oracle:thin:@localhost:1521:XE", "system",
"oracle123");
File image=new File("E:/Users/ganesh/Desktop/line.jpg");
String sql="insert into blobtab values(?,?)";
pstmt=con2.prepareStatement(sql);
pstmt.setString(1,"akshita");
fis=new FileInputStream(image);
pstmt.setBinaryStream(2,(InputStream)fis,(int)(image.length()));
int s = pstmt.executeUpdate();
if (s > 0) {
System.out.println("Image Uploaded successfully !");
} else {
System.out.println("unsucessfull to upload image.");
}
con2.close();
pstmt.close();
回答by DazzaL
This would suggest that your blobtab table didn't have two columns in it (or if there's a trigger on the table, check the DML being fired recursively in those for the same problem).
这表明您的 blobtab 表中没有两列(或者如果表上有触发器,请检查 DML 是否在这些表中递归触发以解决相同的问题)。
insert into blobtab values(?,?)
eg:
例如:
SQL> create table foo(id number);
Table created.
SQL> insert into foo values (1, 2);
insert into foo values (1, 2)
*
ERROR at line 1:
ORA-00913: too many values
check your table. also you should always put explicit column names on your insert (in case someone adds default or nullable columns later on. i.e. always do:
检查你的桌子。此外,您应该始终在插入中放置明确的列名(以防有人稍后添加默认或可为空的列。即始终执行:
insert into blobtab (col1, col2) values(?,?)
where col1
col2
are your real column names.
col1
col2
你真正的列名在哪里。
回答by jaskirat Singh
the number of column would have been less than the paraemeter/argument passed
列数将小于传递的参数/参数
eg: insert into insert into foo(name , age) values (?,?,?)and then preparedStatment object insert
例如:insert into insert into foo(name , age) values (?,?,?)然后preparedStatment 对象插入
Since there is 2 column and value have 3 parametertherefore , ORA-00913: too many values
由于有2 列并且值有 3 个参数,因此 ORA-00913:值太多