powerbuilder中如何使用dblink跨库中的表
在powerbuilder中使用查询语句并返回值
1、定义变量
int ll_rtn //返回值
string ls_sql,ls_where //sql变量和where条件
2、写dblink关联表
ls_sql = "select count(1) from table1@dblink a" + '~r~n'+&
"inner join table2@dblink b on b.id = a.id" + '~r~n'+ &
"inner join table3@dblink c on a.in_id = c.in_id and a.id = c.id" + '~r~n'+ &
"where c.in_id = ?"
ls_where = "变量名"
declare cursor_base dynamic cursor for sqlsa;
prepare sqlsa from :ls_sql using sqlca;
open dynamic cursor_base using :ls_where;
do
fetch cursor_base into :ll_rtn;
loop while sqlca.sqlcode = 0
close cursor_base;
3、返回值
if ll_rtn >0 then
return 1
else
return 0
end if