首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

powerbuilder查询数据库支持with语句么解决办法

2012-02-25 
powerbuilder查询数据库支持with语句么各位好,想请问 要支持with语句如何做我的是powerbuilder 11,5 + DB2

powerbuilder查询数据库支持with语句么
各位好,想请问 要支持with语句如何做

我的是powerbuilder 11,5 + DB2 V9

我是这么做的,

DECLARE get_date CURSOR FOR with temp_date as  
            (  
             select  stu.code  as  code,  
          max(stu.date) as  date         from db2.inst1.stu stu  
             where vp.val_date <= '11/11/2008'  
             group by stu.code  
             )
             select * from temp_date;
可是不行,读取时
    open get_date
Fetch get_date into :ls_code, :ld_date;
if sqlca.sqlcode <> 0 then
messagebox("note", "error is: " + sqlca.sqlerrtext)
end if

告知 cursor is not open, 很明显,sql没有执行成功

望各位大侠告知 :-) 



[解决办法]
DECLARE get_date CURSOR FOR
select code,date from 
            (
             select  stu.code  as  code,
          max(stu.date) as  date         from db2.inst1.stu stu
             where vp.val_date <= '11/11/2008'
             group by stu.code
             ) temp_date ;
这样就不可以了吗?

热点排行