- 论坛徽章:
- 0
|
exec sql begin declare section;
char procname[254] = "batch_storage";
char stmt[256];
sqlint16 int_code;
char str_date[8];
char str_merchant[16];
sqlint16 start_id;
sqlint16 end_id;
exec sql end declare section;
int batch_storage(char *merchant_no,int start_no,int end_no,char *start_date,int code)
{
char sqlstate[256];
struct sqlda *inout_sqlda = (struct sqlda *)
malloc(SQLDASIZE(1));
struct sqlca sqlca;
memset(str_date,0,sizeof(str_date));
memset(str_merchant,0,sizeof(str_merchant));
memcpy(str_date,start_date,strlen(start_date));
memcpy(str_merchant,merchant_no,strlen(merchant_no));
start_id=start_no;
end_id=end_no;
printf("Use CALL with Host Variables to invoke the Server Procedure name=[%s]\n",procname);
sprintf(stmt, "CALL %s (?,?,?,?,?)", procname);
EXEC SQL prepare st from :stmt;
printf("sqlca.sqlcode=[%d]\n",sqlca.sqlcode);
EXEC SQL execute st into :int_code USING :str_merchant:start_id:end_id:str_date;
printf("sqlca.sqlcode=[%d]\n",sqlca.sqlcode);
if(sqlca.sqlcode!=0)
{
return(91);
}
code=atoi(str_code);
free( inout_sqlda );
return 0;
不知道为什么一直报EXEC SQL execute st into :int_code USING :str_merchant:start_id:end_id:str_date;出错
错误信息为:
LINE MESSAGES FOR leave.sqc
------ --------------------------------------------------------------------
SQL0060W The "C" precompiler is in progress.
39 SQL0104N An unexpected token ":" was found following ":".
Expected tokens may include: "END-OF-STATEMENT".
SQL0095N No bind file was created because of previous
errors.
SQL0091W Precompilation or binding was ended with "2"
errors and "0" warnings.
make: *** [leave] Error 4
请高手帮我分析一下 |
|