当前位置: 代码迷 >> PB >> PB动态SQL如何没有返回值
  详细解决方案

PB动态SQL如何没有返回值

热度:150   发布时间:2016-04-29 09:13:46.0
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

有没有值?
------解决方案--------------------
试试这个:

SQL code
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_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……

------解决方案--------------------
C/C++ code
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;
  相关解决方案