One Star

MySQLSyntaxErrorException: Result consisted of more than one row

Hi,
Getting error while loading data into mysql tables.
I have n number of records to load and update 8 different tables.
From source I am getting 10000 records. I am using procedures to update 8 different tables.
Error:
Exception in component tMysqlSP_1
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Result consisted of more than one row
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:353)
at com.mysql.jdbc.Util.getInstance(Util.java:336)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2938)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1601)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1710)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2436)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1402)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:977)
at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:851)

Please help me to solve this.
Thanks
Chin
6 REPLIES
One Star

Re: MySQLSyntaxErrorException: Result consisted of more than one row

Are you doing it all in one statement?
One Star

Re: MySQLSyntaxErrorException: Result consisted of more than one row

Hi,
No. Based on the condition I am calling 7 different procedures in main.
One Star

Re: MySQLSyntaxErrorException: Result consisted of more than one row

Can you post the job.
One Star

Re: MySQLSyntaxErrorException: Result consisted of more than one row

Hi,
I am using procedures
CREATE DEFINER=`MAIN`@`LOCALHOST` PROCEDURE `TESTPROC`(C_ID INT,INEMPCODE VARCHAR(2))
BEGIN
DECLARE TEST1 INT;
SELECT DISTINCT COL1
IF(trim(EMP_CODE)null,trim(EMP_CODE)) as EMP_CODE
......
INTO TEST1
FROM WHERE CONDITION1='A' AND CONDITION2=C_ID

SELECT CONDITION2,....

INTO LLCONDITION2 WHERE CONDITION1='A'

IF (LLCONDITION2 IS NOT NULL) THEN
UPDATE SET ...
.....
WHERE CONDITION2=LLCONDITION2

CALL PROC1(C_ID,LLCONDITION2)
CALL PROC2(C_ID,LLCONDITION2)
CALL PROC3(C_ID,LLCONDITION2)
............
.............
ELSEIF (LLCONDITION2 IS NULL) THEN
INSERT INTO ....
VALUES(,...)

CALL PROC1(C_ID,LLCONDITION2)
CALL PROC2(C_ID,LLCONDITION2)
CALL PROC3(C_ID,LLCONDITION2)
............
.............
ENDIF
END
One Star

Re: MySQLSyntaxErrorException: Result consisted of more than one row

So your problem is in there somewhere. It's a sql fault.
Seventeen Stars

Re: MySQLSyntaxErrorException: Result consisted of more than one row

This happens if a subquery returns more than one row. Subqueries are not allowed to return more than one row.