请教高手,谢谢。

xiaofeng1 2003-10-19 07:22:39
大家讨论一下为什么?
for j=1 to 5
select count(XH)
into :coun
from PXSDM //基本表,xh ,lxnd,xsxz等项
where XSXZ='111'and cast(LXND as int)>=:nd and :nd -cast(RXND as int) +1= :j
using sqlca;
在这个程序中运行结果不正确,但是把where条件中的:j变成具体的数值结果正确,
select count(XH)
into :coun
from PXSDM //基本表,xh ,lxnd,xsxz等项
where XSXZ='111'and cast(LXND as int)>=:nd and :nd -cast(RXND as int) +1= 1
using sqlca;
select count(XH)
into :coun
from PXSDM //基本表,xh ,lxnd,xsxz等项
where XSXZ='111'and cast(LXND as int)>=:nd and :nd -cast(RXND as int) +1= 2
using sqlca;
.........
为什么????
请指教

...全文
20 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
liliang800207 2003-10-19
  • 打赏
  • 举报
回复
先组和sql语句
变量在语句中体现
再用excute immediate :你的sql语句 using sqlca;
xiaofeng1 2003-10-19
  • 打赏
  • 举报
回复
什么是动态SQL语句?
klbt 2003-10-19
  • 打赏
  • 举报
回复
把where条件中的:j变成具体的数值结果正确。
------------------------------------------
确实如此,你要用动态SQL语句实现。

609

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧