高手们帮忙解决一下吧,一定给足分!!!
我在一个包里写了一个存储过程,执行的那些sql语句,提示说“无效的列名”,我通过调试知道是st1,st2的问题,看来oracle还无法识别st1,st2,那么我该如何来引用这两个计算而得的日期变量呢,非常急迫啊,高手们救我,谢谢一定加分!!!
CREATE OR REPLACE package BODY ZXF.Necktie is
-- NecktieList is cursor variable
PROCEDURE sp_Necktie_GetSaleList(s_date1 in zxf.hxda.hxmc%type,s_date2 in zxf.hxda.hxmc%type, NecktieList out sale_outList)
is
begin
--写SQL语句获得需要的变量值!!!
select sfrq into st1 from zxf.sfjl where sfrq <=to_date(s_date1, 'yyyy/mm/dd hh24:mi:ss') and rownum = 1 order by sfrq desc;
select sfrq into st2 from zxf.sfjl where sfrq <=to_date(s_date2, 'yyyy/mm/dd hh24:mi:ss') and rownum = 1 order by sfrq desc;
OPEN NecktieList
FOR 'select a.hxbm as hxbm,
(select nvl(sum(inum),0) from zxf.sfjl where sfrq>= st1 and sfrq <=st2 and sflb=1 and hxbm=a.hxbm) as xsl
from zxf.hxda a
order by hxbm,xsl desc';
end;