简体   繁体   中英

Error while calling java stored procedure in oracle database

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?

The code you posted is creating a stored function, not a stored procedure. If you want to call a function

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

Remember as well that strings in SQL and PL/SQL are delimited by single quotes not double quotes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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