简体   繁体   English

Oracle日期上的Ssrs日期参数

[英]Ssrs on Oracle date parameter

I am using SSRS 2005 to run against a Oracle data source. 我正在使用SSRS 2005对Oracle数据源运行。 I used this simple query 我用这个简单的查询

    SELECT order_number FROM apps.oe_order_headers_all  
    WHERE ordered_date >= :start
    AND ordered_date  < :end + 1
    and rownum = 1

Firstly I got: 首先我得到:

ORA-01745: invalid host/bind variable name ORA-01745:无效的主机/绑定变量名称

I ignore the error and click refresh (to let SSRS determine the columns returned and parameters used) 我忽略该错误,然后单击刷新(让SSRS确定返回的列和使用的参数)

SSRS prompts me for the values of the parameters, I tried 01/01/2014, 01-JAN-2014, 01-01-2014 for both parameters but all got this error: SSRS提示我输入参数的值,我尝试对两个参数使用01/01 / 2014、01-JAN-2014、01-01-2014,但都收到此错误:

Cannot bind type System.String as Blob. 无法将类型System.String绑定为Blob。 (System.Data.OracleClient) (System.Data.OracleClient)

The order_number is NUNBER and ordered_date is DATE in oracle. 在Oracle中,order_number为NUNBER,ordered_date为DATE。

Not sure it's a pl sql thing or SSRS thing? 不确定是pl sql还是SSRS?

Not sure if the second error is just a follow-up to the initial one, but the first error is because start is a reserved word in Oracle ; 不确定第二个错误是否只是第一个错误的后续操作,但是第一个错误是因为start是Oracle中的保留字 you'll get an ORA-01745 from this in SQL*Plus or SQL Developer too: 您也可以在SQL * Plus或SQL Developer中从中获得ORA-01745:

SQL> var start varchar2(10);
SQL> select :start from dual;
select :start from dual
        *
ERROR at line 1:
ORA-01745: invalid host/bind variable name

end is allowed though. 虽然允许end If you change the bind variable name to, say, :start_date - and add the explicit to_date(:start_date, 'YYYY-MM-DD') and to_date(:end_date, 'YYYY-MM-DD') that OracleUser suggested so you know what format to enter the variables in - that will go away. 如果将绑定变量名称更改为:start_date并添加to_date(:start_date, 'YYYY-MM-DD')的显式to_date(:start_date, 'YYYY-MM-DD')to_date(:end_date, 'YYYY-MM-DD')知道以什么格式输入变量-这样就会消失。

I can only imagine that will resolve the second error too, which I guess is coming from the parameter being in an odd state at that point. 我只能想象这也将解决第二个错误,我猜这是由于此时参数处于奇数状态而引起的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM