sql003 存储过程

CREATE OR REPLACE Procedure SP_GETSUMMARY_OILTUBE(well in varchar2,kgsj in varchar2,p_cursor  out ego.cursorType)
as
begin
open p_cursor for
       select decode(xh,'',gjmc,xh) xh,kgrq,GJMC,GJSD,gjxh,gjcd from (
       select decode(xh1,'',xh,xh1) as xh,kgrq,GJMC,GJSD,gjxh,gjcd from (
     select (case when xh in(select min(to_number(xh)) as xh1 from ddb05
 where jh=well and KGRQ=to_date(kgsj,'yyyy-mm-dd'))
 then 'φ'||GJxh end)as xh1,xh,kgrq,GJMC,GJSD,gjxh,gjcd from ddb05  where jh=well
 and KGRQ=to_date(kgsj,'yyyy-mm-dd')));
end;
原文地址:https://www.cnblogs.com/umlzhang/p/2223525.html