i have written a ecpg code. i'm trying to insert a tuple into the table based on if the tuple already exists in the table. i'm getting "error: break statement not within loop or switch " on compiling please help i have commented in the code the line which the compiler showing the error
EXEC SQL DECLARE cursor4 CURSOR FOR
select count(*)
from works_on
where pno = :project
and essn = :ssn;
EXEC SQL OPEN cursor4;
EXEC SQL WHENEVER NOT FOUND DO BREAK;
while (SQLCODE==0)
{
EXEC SQL FETCH IN cursor4 INTO :cnt;
}
EXEC SQL CLOSE cursor4;
EXEC SQL BEGIN DECLARE SECTION;
const char *qry = "INSERT INTO WORKS_ON VALUES(?,?,?);";
EXEC SQL END DECLARE SECTION;
if (cnt == 0 )
{
EXEC SQL PREPARE mystmt from :qry;
exec sql execute mystmt using '123456789',3,5.0; // where i am getting error
}