Ok, let’s say that you need to turn some rows into columns. For example, you have a table where you have information of a person span over several records.

Record 1 contains the type of the person like this: person_id, attribute_id and value.
example : 123, ‘CIVILSTATE’,’married’

Now, you want each attribute to be a column. Well, here is how it goes :

select
  person_id ,
  max( decode( attribute_id, 'value of attribute_id', value, null ) ) as attr0 ,
  max( decode( attribute_id, 'value of attribute_id', value, null ) ) as attr1 ,
  max( decode( attribute_id, 'value of attribute_id', value, null ) ) as attr2 
from your_table
where person_id = 123 and ...
group by person_id