embedded SQL corrupting loops
Date: Mon, 12 Jul 1999 22:38:34 GMT
Message-ID: <7mdqp9$1em$1_at_nnrp1.deja.com>
[Quoted] I have a program that does this loop. If I run an embedded SQL command after I have the number, the number gets corrupted and gets very large. Here's the important parts of the program.
char temp[4][15];
char temp1[4][15];
long int max=0;
for (i=4; i>=0; i--)
{
EXEC SQL select count(*) into :weeksago[i] from sorted where rid=10992 AND ddate between next_day(sysdate-:i*7, 'Sunday') AND next_day(sysdate-(:i-1)*7, 'Saturday');
if (weeksago[i] >= max)
max = weeksago[i];
printf("<p>Max is %d\n", max);}
EXEC SQL select next_day(sysdate-:i*7, 'Sunday') into :temp[i] from
dual;
EXEC SQL select next_day(sysdate-(:i-1)*7, 'Saturday') into :temp1[i]
from dual;
}
The first iteration returns a correct max number because I initialized max to 0. After that, Max goes to 1244475442 or some other large number. If I comment out the SQL statements, max is calculated perfectly all the way through. Even if I take the max part out of this loop and give it its own loop before or after the SQL statement loop, max still gets large when I need it later. Someone please help with this. let me know if you need more info.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Tue Jul 13 1999 - 00:38:34 CEST