I have a SQL statement with five fields and I want to be able to sort it dynamically by setting the sort order as a parameter. The first field is a group by field so I have written something like select v1, v2, v3, v4, v5 from tab order by $P{p1} I set the value of p1 parameter to something like " 1, 3" or " 1,4". It seems to ignore sort order altogether. However if I hardcode order by clause to be 'order by 1,3' it works. What is going on? Can we not set the sort order dynamically? I have tried other variants for 'order by' clause but cannot get it work. Help! Reagrds Rajeev