日期:2014-05-16 浏览次数:21018 次
EXEC SQL DECLARE cur_001 CURSOR FOR SELECT name FROM same_table; EXEC SQL OPEN cur_001; while(1) { EXEC SQL FETCH cur_001 INTO :a; if(sqlca.sqlcode == 1403 ) break; else if(sqlca.sqlcode != 0) return -1; printf("%s 的成绩单如下:\n-------------------------------\n科目 | 分数\n",a); /*当cur_001还没有被取完时*/ EXEC SQL DECLARE cur_002 CURSOR FOR SELECT kemu,chengji FROM any_talbe where name = :a; EXEC SQL OPEN cur_002; while(1) { EXEC SQL FETCH cur_001 INTO :km,cj; if(sqlca.sqlcode == 1403 ) break; else if(sqlca.sqlcode != 0) return -1; printf("%s | %d\n-----------------------------------\n",km,cj); } }