How can I apply Unpivot in a simple select, I want to leave a query vertically

0

According to the code below:

SELECT 1 DADO1 ,2 DADO2 FROM DUAL

I would like to leave the search result vertically, I am a beginner in Oracle, I saw what to do with unpivot but I did not find a simple example demonstrating the vertical column inversion and its results next to each field.

    
asked by anonymous 14.03.2017 / 15:06

1 answer

0

As per the query used, it follows as below. To suit your scenario, I recommend consulting Documentation - Pivot and Unpivot EN .

SELECT valor
  FROM ((SELECT '1' dado1
               ,'2' dado2
               ,'3' dado3
               ,'4' dado4
               ,'5' dado5
           FROM dual)
        unpivot(valor FOR tipo_de_valor IN (dado1
                                 ,dado2
                                 ,dado3
                                 ,dado4
                                 ,dado5)))
    
14.03.2017 / 18:05