PB动态SQL怎么没有返回值
string name,ls_sql,code
dec ld_value
code= "1"
ls_sql= "select sum(a.value) from ttt a"
DECLARE c1 DYNAMIC CURSOR FOR SQLSA;
PREPARE SQLSA FROM :ls_sql;
OPEN DYNAMIC c1 USING :code;
FETCH c1 INTO :ld_value;
If SQLCA.SQLCode=0 then //如果成功取出记录
messagebox('',string(ld_value))
end if
CLOSE c1;
怎么执行后没有返回值,请大家帮忙看看!!!
[解决办法]
select sum(a.value) from ttt a
有没有值?
[解决办法]
试试这个:
string ls_sql dec ld_value ls_sql= "select sum(a.value) from ttt a" DECLARE c1 DYNAMIC CURSOR FOR SQLSA; PREPARE SQLSA FROM :ls_sql; FETCH c1 INTO :ld_value; If SQLCA.SQLCode=0 then //如果成功取出记录 messagebox('',string(ld_value))end if CLOSE c1;
[解决办法]
string name,ls_sql,code dec ld_valuecode= "1" ls_sql= "select sum(a.value) from ttt a where code = ?" DECLARE c1 DYNAMIC CURSOR FOR SQLSA; PREPARE SQLSA FROM :ls_sql; OPEN DYNAMIC c1 USING :code; FETCH c1 INTO :ld_value; If SQLCA.SQLCode=0 then //如果成功取出记录 messagebox('',string(ld_value))end if CLOSE c1;