各位好,想请问 要支持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 ;
这样就不可以了吗?