create function uf_generated_profile_table() 
returns table 
as return (
select p.id,
MOSTYPE = (SELECT operator + ':' + c_value FROM t_profile_column_values WHERE c_name='MOSTYPE' and id = p.id),
MAANTHUI = (SELECT operator + ':' + c_value FROM t_profile_column_values WHERE c_name='MAANTHUI' and id = p.id),
MGEMOMV = (SELECT operator + ':' + c_value FROM t_profile_column_values WHERE c_name='MGEMOMV' and id = p.id),

/* similar statements removed to shorten code listing */

AFIETS = (SELECT operator + ':' + c_value FROM t_profile_column_values WHERE c_name='AFIETS' and id = p.id),
AINBOED = (SELECT operator + ':' + c_value FROM t_profile_column_values WHERE c_name='AINBOED' and id = p.id),
ABYSTAND = (SELECT operator + ':' + c_value FROM t_profile_column_values WHERE c_name='ABYSTAND' and id = p.id)
 from t_profile_column_values p
 group by id )

