Multiple parameters passed from Reporting Services to an Oracle database
I have an oracle procedure that works fine with reporting services if I want either 'All' of the items in the list
or if I want just one, but not multiples. I have tried creating a function from code I found but I get
an error "Error(4,23): PLS-00201: identifier '','' must be declared". I have done very little work with either
Oracle or reporting services. Can someone please give me very clear detailed instructions on
what I'm doing wrong. Thank you. My deadline is tomorrow.
create or replace function MultiParam( p_cursor sys_refcursor, p_del varchar2 := "','") return varchar2is l_value varchar2(32767); l_result varchar2(32767);begin loop fetch p_cursor into l_value; exit when p_cursor%notfound; if l_result is not null then l_result := l_result || p_del; end if; l_result := l_result || l_value; end loop; return l_result;end MultiParam;
From the little you posted, I would guess that you are wanting to pass a comma delimited list into a function/procedure and have it processed in some IN-List in a query.
This can be done but you need to use Dynamic SQL.
I can help with the PL/SQL code but have never touched Reporting Services.
bmurray61259
ASKER
I am receiving a list from reporting services like the following
'123, 456, 789'. What I need is a list for the parameter that looks like '123', '456', '789'.
I create the variable which is a varchar2 in a stored procedure. The original line that gets me either all or one is WHERE (sitrepinteractionfields.sitename = p_Site OR NVL(p_Site, ' ') = ' ' or p_Site = 'All')
If you need any other info let me know.
bmurray61259
ASKER
I am receiving a list from reporting services like the following
'123, 456, 789'. What I need is a list for the parameter that looks like '123', '456', '789'.
I create the variable which is a varchar2 in a stored procedure. The original line that gets me either all or one is WHERE (sitrepinteractionfields.sitename = p_Site OR NVL(p_Site, ' ') = ' ' or p_Site = 'All')
You will need to use dynamic sql or a little smoke and mirrors.
bmurray61259
ASKER
procedure Rpt_Multiple (p_Site varchar2 , p_ Type varchar2 , p_Status varchar2 , p_Start date :=null , p_End date :=null , cur_Multiple out t_cursor ) AS BEGIN open cur_Multiple for SELECT sitename , type , status , SITREPID , Service , ItemName , CreateDate , ModifiedDate FROM interactionfields Inner Join sitreps on interactionfields. id = sitreps. id WHERE (sitename in p_Site OR NVL(p_Site, ' ') = ' ' or p_Site = 'All Locations') and (incidenttype = p_Incident_Type or NVL(p_Incident_Type, ' ') = ' ' OR p_Incident_Type = 'All' ) and (status = p_Status OR NVL(p_Status, ' ') = ' ' OR p_Status = 'All') and (CreateDate <= p_ReportDateEnd or NVL(To_Char(p_ReportDateEnd, 'DD-MON-YY'),' ')= ' ' ) and (CreateDate >= p_ReportDateStart or NVL(To_Char(p_ReportDateStart, 'DD-MON-YY'),' ')= ' ' ) ;END Rpt_Multiple;
From the little you posted, I would guess that you are wanting to pass a comma delimited list into a function/procedure and have it processed in some IN-List in a query.
This can be done but you need to use Dynamic SQL.
I can help with the PL/SQL code but have never touched Reporting Services.