oracle的简单函数 存储过程,触发器

1.函数,、

create or replace function a_skucon(v_orderid in number,v_isprint in number,v_issku in number,v_isproduct in number)
return varchar2

is
       temp varchar2(500);
       --V_ISPRINT 是否打印
       --V_ISSKU 是否打印SKU
       --V_isproduct 是否打印商品名称
begin
 IF(v_isprint='1') THEN

             temp:='';
             for temprow in(select tbop.outer_sku_id,tbop.title,count(1) as pcount

             from tb_orderproduct tbop
              where tbop.orderid=v_orderid
              and rownum<=5
              group by tbop.outer_sku_id,tbop.title
              ) loop
                --temp:=temp||';'||temprow.outer_sku_id;
                if(v_issku='1') then
                                temp:=temp||';'||temprow.outer_sku_id;
                end if;
                if(v_isproduct='1') then
                                temp:=temp||' '|| temprow.title;
                end if;

                temp:=temp||'('||temprow.pcount||')';

              end loop;

              temp:=substr(temp,2);
               return temp;

     /*    if (v_isproduct='1') THEN
                temp:='';
                for temprow in(select tbop.title
                from tb_orderproduct tbop
                where tbop.orderid=v_orderid) loop
                  temp:=temp||';'||temprow.title;
                 end loop;
                 return temp;
           end if;*/
end if;

end a_skucon;

2.存储过程



你可能感兴趣的:(oracle的简单函数 存储过程,触发器)