0

I have created a RunnableJar (a jar containing other third party jars like iText.jar, java classes, etc...) and I have upload that RunnableJar.jar in Oracle database using loadjava. In the jar i have main class GetOffer in that i have one public String getOffer(String param1) { } method and the use of this method is to create multiple pdf according to user selection and concat them.

Now I have created Stored procedure:

create or replace function getOffer(param1 in varchar2) return varchar2
    is language java name 'GetOffer.getOffer(java.lang.String) return java.lang.String';

And I have called this stored procedure using following call statement:

SQL> VARIABLE  myString  VARCHAR2(20);
SQL> CALL getOffer("XYZ") INTO :myString

When calling the procedure I am getting the below error:

SQL> VARIABLE  myString  VARCHAR2(20);
SQL> CALL getOffer("XYZ") INTO :myString
 2  ;
CALL getOffer("Any String") INTO :myString
 *
ERROR at line 1:
ORA-06576: not a valid function or procedure name

How can I solve this problem?

4

1 回答 1

1

您发布的代码是创建存储函数,而不是存储过程。如果你想调用一个函数

SELECT getOffer('xyz')
  INTO :myString
  FROM dual;

还要记住,SQL 和 PL/SQL 中的字符串由单引号而不是双引号分隔。

于 2013-06-14T15:41:16.513 回答