从 SSRS 调用 oracle 包

Calling oracle package from SSRS

我想将日期范围和员工 ID 从 SSRS 发送到 Oracle 包。有谁知道该怎么做?即使我尝试用三个参数 from_date、to_date 和 employee_id 声明一个 oracle 程序包,它也可以使用一个员工 ID 正常工作。但是,如果我 select SSRS Web 界面中的多名员工说出错误的参数数量,则会失败。有人知道如何处理吗?

通常使用 SQL 和 SSRS,你会做类似

的事情

Select * From Table where Table.Field in @Param

Oracle 当然不同,取决于您使用的连接类型。

ODBC 连接你会使用类似的东西: Select * From Table where Table.Field = ? 参数的顺序在这里很重要,所以要小心。

OLEDB 连接你会使用类似的东西: Select * From Table where Table.Field = :Param

然而,上述 none 与参数的多选一起工作。你可以这样做:

=”Select * From Table where Table.Field in (‘” + Join(Parameters!parameter.Value,”‘, ‘”) + “‘)”

=”Select * From Table where Table.Field in(” + Join(Parameters!parameter.Value,”, “) + “)” 如果值或您的字段仅为数字。

这里有几篇不错的文章,您可以看看。它的解释比我个人在没有更多信息的情况下所能给出的更好;您的 Oracle 环境、连接类型等的详细信息

Quick Reference:

  1. Be sure your Oracle version is 9 or greater, none of this works on versions 8 or older.
  2. When using parameters with Oracle, use a : instead of an @ sign – :param instead of @param.
  3. Add an ‘ALL’ option to your datasets that supply values for multivalued drop down parameters.
  4. Check for the ALL in your where clause by using “where ( field1 in ( :prmField1 ) or ‘ALL’ in ( :prmField1 ) )” syntax.
  5. You can execute your query from the dataset window, but can only supply 1 value. However that value can be ‘ALL’.
  6. Educate your users on ‘ALL’ versus ‘(select all)’ .

另一篇关于 Oracle 的 SSRS 中的多个参数的好文章:Davos Collective 在顶部引用了这篇文章。

希望这对您有所帮助!