I have written following piece of code in C:
EXEC SQL begin declare section;
int A;
char B[5];
int C;
int D;
dtime_t E;
char F[13];
EXEC SQL END DECLARE SECTION;
char E_dt[16];
D=0;
memset(F, 0, sizeof(F));
EXEC SQL declare log3 cursor for select A, B, C, D, E, F from tbl WHERE C=123;
if(sqlca.sqlcode)
{
return;
}
EXEC SQL fetch log3
into
:A, :B, :C, :D, :E, :F,
if(sqlca.sqlcode)
{
if (sqlca.sqlcode != DB_NORECORDS)
{
return;
}
break;
}
When we run this piece of code, where the value of F is Null in the table tbl. It gives error code 1405. I have tried memset function for setting its default value as 0. But it did not work. And one more thing can i fetch more than 90 field at a time, when i was trying to do that it gives me Bus Error at the time of compilation. Thanks in advance please help me out.
You have 2 basic options:
Edit:
Example with NVL for log3 cursor. Choose whatever default values you want. In the example I have used ‘ ‘ for character fields, 0 for numeric fields and Jan 1st year 1 for dates.