动态游标含参数查询多条记录并输出多个参数
程序段03
这段程序利用动态游标含参数查询多条记录并输出多个参数
string strvar
int intvar,i
string dstring
dstring="SELECT name, sex FROM auths"
DESCRIBE SQLSA FROM : dstring;
DECLARE C1 DYNAMIC CURSOR FOR SQLSA;
lab1:
FETCH C1 USING DESCRIPTOR SQLDA;
if SQLCA.SQLCode=0 then //若FETCH成功
for i=1 to SQLDA.NumOutputs
//SQLDA.NumOutPuts 含有输出参数个数
CHOOSE CASE SQLDA.OutparmType[i]
CASE TypeString!
strvar= GetDynamicString (SQLDA,i)
CASE TypeInteger!
intvar= GetDynamicNumber (SQLDA,i)
END CHOOSE
next
got lab1 //如果成功取出记录,则取下一条
end if
CLOSE C1;