select (e.a - s.a), (e.b - s.b),(e.c - s.c)
from yourtable s, yourtable e
where s.date_field = date_s and e.date_field = date_e
from yourtable s, yourtable e
where s.date_field = date_s and e.date_field = date_e
sum(decode(date,date_e,b,date_s,-1*b,date,0)) as "b"
sum(decode(date,date_e,c,date_s,-1*c,date,0)) as "c"
from tablename
where date = date_e or date = date_s
AS
TYPE myrctype IS REF CURSOR;
END pkg_test;
/create or replace procedure name_pro(p_begin in date,p_end in date,p_rc out pkg_test.myrctype)
as
str varchar2(50);
begin
str:='select (aa.a-bb.a) a,(aa.b-bb.b) b,(aa.c-bb.c) c from (select * from table_name where date='||p_begin||') aa,(select * from table_name where date='||p_end||') bb';
open p_rc for str;
end;
/在asp就可调用该过程。