2009-04-26 9 views

Répondre

2

C'est une façon que j'ai compris:

cols_to_select := according to a set of rules, we get the name of the columns 

FOR I IN EXECUTE 'SELECT ARRAY['||cols_to_select||'] as AR FROM tabl' LOOP 
    -- how to access to fields of record I without knowing their names? 
    FOR j IN 1..array_upper(I.ar,1) LOOP 
    RAISE NOTICE '%', I.AR[j]; 
    END LOOP; 

END LOOP; 

Le problème avec cette solution est que échoue lorsque les colonnes ont des types différents .

Questions connexes