SSRS multi-value parameter using a stored procedure

后端 未结 5 1763
长情又很酷
长情又很酷 2020-11-27 05:51

I am working on a SSRS report that uses a stored procedure containing a few parameters. I am having problems with two of the parameters because I want to have the option of

5条回答
  •  不知归路
    2020-11-27 06:27

    When SSRS passes the parameter it is in the form: Param1,Param2,Param3.

    In the procedure, you just need to put identifiers around each parameter. And also identifiers around the value that is returned by the dataset. In my case, I used semicolons.

    CREATE OR REPLACE PROCEDURE user.parameter_name ( i_multivalue_parameter ) AS l_multivalue_parameter varchar2(25555) := ';' || replace(i_multivalue_parameter,',',';') || ';'; BEGIN select something from dual where ( instr(l_multivalue_parameter, ';' || database_value_that_is_singular || ';') > 0 ) END;

    i_multivalue_parameter is passed in via SSRS.

    l_multivalue_parameter reads the parameter passed in via SSRS and puts identifiers around each value.

    database_value_that_is_singular is the value returned for each record.

    So if 'Type1,Type2,Type3'is passed in via SSRS:

    i_multivalue_parameter is: Type1,Type2,Type3

    l_multivalue_parameter is: ;Type1;Type2;Type3;

    database_value_that_is_singular is: ;Type1; or ;Type2; or ;Type3;

    Instr will return a value over 0 if the parameter matches.

    This works even if each parameters are similar. EG: "Type A" and "Type AA". That is "Type A" will not match "Type AA".

提交回复
热议问题