Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help with Invalid Parameter Binding issue

710634Jul 7 2009 — edited Jul 7 2009
let me prefix this with the fact that I'm about as ignorant as can be when it comes to oracle so speak slowly and hopefully I'll catch the low hanging fruit.

I've inherited a project that someone else wrote and I'm trying to make the code base work, but I am getting 2 error messages and don't really know where to start to fix it.

My project is using ActiveReports (yea I hate it too) to call a function into a 10g database. It is returning an error saying Invalid Identifier. When I try to run the function in visual studio I get an invalid parameter binding error message and it says parameter name "" (empty quotes, so who knows).

here's what I have:

the type definition:
TYPE type_A AS OBJECT (date_a VARCHAR2(25), start_date VARCHAR2(25), end_date VARCHAR2(25), items_total INT, items_with_x INT, items_without_x INT, items_with_x_percent DECIMAL(7,6), items_without_x_percent DECIMAL(7,6))

the type table:
TYPE type_A_table AS TABLE OF type_A

the function that is erroring:
<em>FUNCTION func_A (start_date_str IN VARCHAR2, end_date_str IN VARCHAR2) RETURN type_A_table PIPELINED
IS
PRAGMA AUTONOMOUS_TRANSACTION;
&nbsp;&nbsp;&nbsp;&nbsp;start_date_filter TIMESTAMP := TO_DATE(start_date_str,'MM/dd/yyyy HH:MI:ss AM');
&nbsp;&nbsp;&nbsp;&nbsp;end_date_filter TIMESTAMP := TO_DATE(end_date_str,'MM/dd/yyyy HH:MI:ss AM');
&nbsp;&nbsp;&nbsp;&nbsp;items_total INT;
&nbsp;&nbsp;&nbsp;&nbsp;items_with_x INT;
&nbsp;&nbsp;&nbsp;&nbsp;items_without_x INT;
&nbsp;&nbsp;&nbsp;&nbsp;items_with_x_percent DECIMAL(7,6);
&nbsp;&nbsp;&nbsp;&nbsp;items_without_x_percent DECIMAL(7,6);
&nbsp;&nbsp;&nbsp;&nbsp;temp type_A;
BEGIN
&nbsp;&nbsp;&nbsp;&nbsp;SELECT COUNT(*) INTO items_total FROM atable WHERE (create_date BETWEEN start_date_filter AND end_date_filter);
&nbsp;&nbsp;&nbsp;&nbsp;SELECT COUNT(*) INTO items_with_x FROM atable WHERE conditionx=1 AND (create_date BETWEEN start_date_filter AND end_date_filter);
&nbsp;&nbsp;&nbsp;&nbsp;SELECT COUNT(*) INTO items_without_x FROM atable WHERE conditionx=0 AND (create_date BETWEEN start_date_filter AND end_date_filter);
&nbsp;&nbsp;&nbsp;&nbsp;items_with_x_percent := 0.00;
&nbsp;&nbsp;&nbsp;&nbsp;items_without_x_percent := 0.00;
&nbsp;&nbsp;&nbsp;&nbsp;IF items_total > 0 THEN
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items_with_x_percent := (items_with_x*1.00)/(items_total*1.00);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items_without_x_percent := (items_without_x*1.00)/(items_total*1.00);
&nbsp;&nbsp;&nbsp;&nbsp;END IF;
&nbsp;&nbsp;&nbsp;&nbsp;temp := type_A(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TO_CHAR(CURRENT_DATE,'MM/dd/yyyy HH:MI:ss AM'),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start_date_str,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end_date_str,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items_total,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items_with_x,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items_without_x,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items_with_x_percent,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items_without_x_percent
&nbsp;&nbsp;&nbsp;&nbsp;);
&nbsp;&nbsp;&nbsp;&nbsp;PIPE ROW(temp);
&nbsp;&nbsp;&nbsp;&nbsp;RETURN;
END;</em>

I've changed some of the details here from the original so there may be some syntax errors but hopefully you get the gist of the situation.



any help would be appreciated.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2009
Added on Jul 7 2009
3 comments
3,616 views