Oracle - From / to WebFocus to Oracle

0

Well, I'd like some help.

I have an ETL that was created in WebFocus, and I'm going to migrate it to Oracle.

I have already done a good part of the / paras, and would like an alternative to the following situations. In WebFocus, it can use an earlier column, already calculated as a parameter for calculating another value.

Example:

SUM(CASE
   WHEN T1.M2143831 > T1.M2460254
     THEN
       (T1.M2143831 * 100 / T1.M2143833)
     ELSE
       (T1.M2460254 * 100 / T1.M2460256)
END) AS TAXA_L,
SUM(CASE
   WHEN T4.FABRICANTE_ID = 'TESTE'
        AND TAXA_L >= 80
     THEN  1
   ELSE NULL
END) MAIOR80

As the example, it uses TAXA_L calculated in the previous step as a parameter, and in Oracle I can not do this.

I tried the following:

SUM(CASE
      WHEN T4.FABRICANTE_ID = 'TESTE'
         AND SUM(CASE
                    WHEN T1.M2143831 > T1.M2460254
                    THEN
                        (T1.M2143831 * 100 / T1.M2143833)
                    ELSE
                        (T1.M2460254 * 100 / T1.M2460256)
                 END) >= 80
      THEN
         1
      ELSE
         NULL
END)AS MAIOR80

But I get the following error:

ORA-00937: not a single-group group function

I'm breaking my head with this, is there any alternative?

    
asked by anonymous 17.10.2016 / 20:02

1 answer

0

Problem solved using CTE framework. CTE-Oracle .

I broke the query in two steps.

Here are some examples:

18.10.2016 / 18:27