在BIP中按条件排序

时间:2015-05-21 11:17:42

标签: bi-publisher

我的数据模型中的ORDER BY条件有问题。我想将参数传递给ORDER BY并根据参数值对数据进行排序。 这是代码:

select *
from   (
   select t1.header_id,
          t1.ebs_trx_number BROJ_FAKTURE,
          t1.premise_or_group_code OZNAKA_PROSTORA_ILI_GRUPE,
          t1.SHIP_TO_ADDRESS ADRESA_PROSTORA_ILI_GRUPE,
          to_number(t1.code_customer) SIFRA_KUPCA,
          t1.name_customer NAZIV_KUPCA,
          t1.heating_type VRSTA_GREJANJA,
          t1.amount_vat_excluded IZNOS_BEZ_PDV,
          t1.amount_vat PDV,
          t1.amount_vat_included IZNOS_SA_PDV
   from   XXBILL.XXBILL_INVOICE_HEADERS_HISTORY t1
   where  t1.billing_period = :P_PERIOD
   and    t1.heating_type = nvl(:P_HEATING_TYPE, t1.heating_type)
   UNION
   select t2.header_id,
          t2.ebs_trx_number,
          t2.premise_or_group_code,
          t2.SHIP_TO_ADDRESS,
          to_number(t2.code_customer),
          t2.name_customer,
          t2.heating_type,
          t2.amount_vat_excluded,
          t2.amount_vat,
          t2.amount_vat_included
   from   XXBILL.XXBILL_INVOICE_HEADERS t2
   where  exists (select 1
                  from   xxbill.xxbill_period t3
                  where  t3.ID_PERIOD = :P_PERIOD
                  and    t3.STATUS = 'OTV')
   and    t2.heating_type = nvl(:P_HEATING_TYPE, t2.heating_type)
   )
order  by :P_SORT

P_SORT可以是2,3或5,BIP接受此代码,但只想对数据进行排序。

有谁知道如何解决这个问题?

提前致谢, 斯蒂芬

1 个答案:

答案 0 :(得分:2)

如果您想按列排序:p_short,它应包含多个值。 要将更多的一个值用于参数,您必须为该参数创建LOV。如果您为参数输入单个值,则可能无法正常工作。

希望它有意义。

如果您有任何其他问题,请更新?