Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a report with Dynamic order by clause

Status
Not open for further replies.

raskotha

Programmer
Jul 6, 2007
1
US
I have report and one of the report parameter will be having the column name.

I am trying to use this value just like any other substitute variable :)P_DATE).

Select
col1,
col2,
sum(col3),
sum(col4)
from tab1
where cond1 = <>
group by col1
order by :p_FILTER_VALUE

Where the value of:p_FILTER_VALUE is 'col1'

When i execute the report the data is not in sort ( in this case data not sorted by col1)

FYI- Break Order property -> none.
Is this wrong? What should be done to make it happen
 
You should use lexical rather than bind parameter:
Code:
Select 
col1,
col2,
sum(col3),
sum(col4)
from tab1
where cond1 = <>
group by col1
order by &P_FILTER_VALUE

Note that P_FILTER_VALUE Initial value must be valid order by clause

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top