DbVisualizer在我的Oracle DB函数调用中插入一个参数

时间:2013-07-24 15:40:11

标签: dbvisualizer

我正在尝试在Oracle数据库中编写一个函数。当我在函数编辑器中并尝试运行它时,DbVis会插入一个额外的参数。

@call [dbvis - v0] = SP_GET_ANNUAL_SALES_HISTORY( [dbvis - v1], 'DAL', '00105315', '2013' );
@echo returnValue = [dbvis - v0];
@echo p1 = [dbvis - v0];

然后我收到此错误:

... Physical database connection acquired for: JdaTest
10:36:40  [@CALL - 0 row(s), 0.000 secs]  [Error Code: 6550, SQL State: 65000]  ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'SP_GET_ANNUAL_SALES_HISTORY'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
10:36:40  [@ECHO - 0 row(s), 0.000 secs]  returnValue = null
10:36:40  [@ECHO - 0 row(s), 0.000 secs]  p1 = null
... 3 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec  [2 successful, 0 warnings, 1 errors]

这是我的功能。这是我第一次涉足存储过程。在这一点上,我只是想让它运行并交付一些结果。返回类型是我也创建的类型。它是'创建或替换类型'SAPMGR“。”ANNUAL_SALES_HISTORY“是数字'的Varray(12)

CREATE OR REPLACE FUNCTION "SAPMGR"."SP_GET_ANNUAL_SALES_HISTORY" (loc_in IN varchar2,item_in IN varchar2,year_in IN varchar2)
RETURN annual_sales_history
AS
        yearStart       Date;
        yearEnd         Date;
        start_date      sales_history.start_date%TYPE;
        qty             sales_history.quantity%TYPE;
        ash             annual_sales_history;        

        cursor c1 is
        select start_date,QTY 
        from sales_history
        where item = item_in
          and loc = loc_in
          and start_date between yearStart and yearEnd
        order by item, loc, start_date;

BEGIN
        Loop
                fetch c1 into start_date, qty;
                exit when c1%notfound;
                ash(extract(month from start_date)) := qty;

                DBMS_OUTPUT.PUT_LINE( 'ash' || ' ' || ash(0) || ' ' || ash(1) || ' ' || ash(2) || ' ' || ash(3) || ' ' || ash(4) || ' ' || ash(5)|| ' ' || ash(6) || ' ' || ash(7));      
        End loop

        commit;
        close c1;
EXCEPTION
WHEN OTHERS THEN
   raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);        

        RETURN ash;
 END;

什么是[dbvis-v1]以及如何摆脱它?或者,请告诉我我可能会遗漏的地方

感谢。

1 个答案:

答案 0 :(得分:0)

我收到来自DbVisualizer的邮件,他们的编辑器无法识别自定义数据类型,这就是我的尝试。所以,留在原生类型,你没事。