int test(task)
{
int XXX;
//定义宿主变量--可以与proc程序交互的C变量
EXEC SQL BEGIN DECLARE SECTION;
char dateTime[14+1];
char cardID[128+1];
char oriFileName[128+1];
char cardNo[40+1];
char oriCardRecord[2048+1];
EXEC SQL VAR cardNo IS STRING(40+1);
EXEC SQL VAR oriCardRecord IS STRING(2048+1);
int status;
EXEC SQL END DECLARE SECTION;
strcpy(dateTime,ptask->dateTime);
strcpy(cardID,ptask->cardID);
strcpy(oriFileName,ptask->oriFileName);
//定义游标--其中":dateTime"表示引用宿主变量
EXEC SQL DECLARE keyGenerateCur CURSOR FOR SELECT
trim(uncardNo),trim(unoriCardRecord)
FROM iccarddataprocesstaskdetail
WHERE ( undateTime = :dateTime AND uncardID = :cardID AND unoriFileName = :oriFileName AND unstatus = :status )
ORDER BY uncardNo;
//打开游标
EXEC SQL OPEN keyGenerateCur;
//取游标的值赋值给宿主变量
EXEC SQL FETCH keyGenerateCur INTO
:cardNo,:oriCardRecord;
//关闭游标
EXEC SQL CLOSE keyGenerateCur;
}
阅读(1033) | 评论(0) | 转发(0) |