Groups | Blog | Home
all groups > sql server reporting services > july 2006 >

sql server reporting services : Using parameters with Oracle query


Peter
7/24/2006 4:22:42 PM
Hello,

I'm using SQL Server 2000 Reporting Services.

I need to create a report based on a simple query:

SELECT SUM(DISC) AS DISC, IMPACT, ADDDATE, YEAR, MONTH
FROM RPT_DRS_BY_MONTH_VU
GROUP BY IMPACT, ADDDATE, YEAR, MONTH
ORDER BY YEAR DESC, MONTH

The user must be able to select a Year to view the report. So I need to
add a parameter.

This should be no problem, should I use SQL Server. But I'm using
Oracle. So when I add a parameter to a datasource - it doesn't work.
For instance, in SQL Server it would look like this:

SELECT SUM(DISC) AS DISC, IMPACT, ADDDATE, YEAR, MONTH
FROM RPT_DRS_BY_MONTH_VU
WHERE (YEAR=@Year)
GROUP BY IMPACT, ADDDATE, YEAR, MONTH
ORDER BY YEAR DESC, MONTH

But in this case the parameter is treated as a string value and
automatically enclosed in the single qoutes, like this:

SELECT SUM(DISC) AS DISC, IMPACT, ADDDATE, YEAR, MONTH
FROM RPT_DRS_BY_MONTH_VU
WHERE (YEAR='@Year')
GROUP BY IMPACT, ADDDATE, YEAR, MONTH
ORDER BY YEAR DESC, MONTH

In other words, it doesn't work.

I'm new to the Reporting services, so I'm stuck.

Could anyone give me a hint how to achieve this in Oracle? I would
really appreciate it.

Thank you,

Peter
Rob
7/25/2006 1:57:02 PM
Peter,

Do a search for "parameter oracle" in the search box above, you will get
more than a couple of good hits regarding this.

I had the same issue 2 weeks ago (and I also forgot to do a search as well).

Basically, use : instead of @; but do the search and read some of the
replies, it helped me.

I hope this helps.
Rob Cuscaden

[quoted text, click to view]
Peter
7/25/2006 3:11:33 PM
Rob, thank you very much! I'll do the search, but your suggestion is
already working.

Peter

[quoted text, click to view]
AddThis Social Bookmark Button