Calling a Java Store Procedure from PL\SQL

I have this code in pl/sql
FUNCTION validate_against_schema (p_schema IN VARCHAR2, p_xml IN BLOB)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'JAVA_SCHEMA_VALIDATOR.validation(java.lang.String, java.sql.Blob) return java.lang.String';
And when i'm calling it i'm getting the following error:
ORA-00932: inconsistent datatypes: expected an IN argument at position 2 that is an instance of an Oracle type convertible to an instance of a user defined Java class got an exception while converting to the user class
I had this code working in another database user, but in the new user i get this error. There's something i have to do for the conversation BLOB-> java.sql.Blob run without a problem?

Antonio,
Are you sure you didn't use oracle.sql.BLOB instead of java.sql.Blob?
Cheers,
Colin

Similar Messages

  • Calling a java loaded API from PL/SQL

    HI,
    I have a java program loaded in the Database.
    For sake of clarity I am posting the java Program also.
    package mypackage1;
    public class WriteClob extends CLOB
    public static void main(String[] args) {
    Connection conn = null;
    String url = null;
    String user = null;
    String password = null;
    Properties props = new Properties();
    String fileName = null;
    String xml_test ="KINGSTON";
    StringBuffer s_xml = new StringBuffer();
    // PreparedStatement ps = null;
    OraclePreparedStatement ps=null;
    int ret_int=0;
    props.put("user", "apps" );
    props.put("password", "apps");
    long len=0;
    int temp;
    ResultSet rs = null;
    SimpleDateFormat fSDateFormat = null;
    props.put("SetBigStringTryClob", "true");
    long first=System.currentTimeMillis();
    url = "jdbc:oracle:thin:@ap619sdb:4115:owf12dev";
    user = "apps";
    password = "apps";
    try
    DriverManager.registerDriver(new OracleDriver()); // Get the database connection
    conn = DriverManager.getConnection( url, props );
    long second=System.currentTimeMillis();
    System.out.println("Time between conn. "+(second-first));
    first=System.currentTimeMillis();
    for (int i =0;i<1000;i++){
    s_xml.append(xml_test);
    second=System.currentTimeMillis();
    System.out.println("Time between loop "+(second-first));
    first=System.currentTimeMillis();
    ps =(OraclePreparedStatement) conn.prepareStatement("insert into xml_clob_temp1 values(:1)");
    ps.setString(1,s_xml.toString());
    ps.executeUpdate();
    second=System.currentTimeMillis();
    System.out.println("Time between loop "+(second-first));
    } catch(SQLException sqlexp){ sqlexp.printStackTrace(); }
    Now i am trying to create a procedure to call this Java API.
    create or replace package load_perf as
    procedure WriteClob ;
    end;
    create or replace package body load_perf as
    procedure WriteClob
    is
    language java name 'mypackage1.WriteClob.main(java.lang.String)';
    end;
    I have tried debugging this a lot and am not able to overcome this error while creating the procedure.
    LINE/COL ERROR
    3/1 PL/SQL: Item ignored
    5/15 PLS-00311: the declaration of
    "mypackage1.WriteClob.main(java.lang.String)" is incomplete or
    malformed
    I have earlier created Java APIs which have returned some value and have been able to load them in the DB and call through a PL/SQL function wrapper.
    But I am unable to create a procedure for this.
    I have tried all sorts of debugging but always am getting error around this.
    Can someone Please take a look at this Pronblem.
    Thanks In Advance,
    Gaurav

    A proper designed application in the database tier is far more scalable and performs better than using a separate middle tier for the application.
    This should be self evident.
    A middle tier requires more moving parts between the application and data. There now sits a network pipe between application and data. There are more software layers that slows down the interaction of the application with the data - more stuff that can go wrong. More stuff that needs to be maintained and configured and secured.
    What's more, the database tier is a lot more scalable than the middle tier. Oracle Real Application Clusters. Oracle Parallel Processing. Oracle Shared Server. Etc.
    These are robust and mature technologies.
    One major fact that seems to be missed by so-called IS architects favouring a middle tier is that the middle tier cannot make a single database query or transaction go faster.
    Scaling the middle tier is done by throwing more hardware at it. But not a single additional mid-tier h/w platform will make the database tier any faster. Will make the database tier scale.
    Then there is also the issue of costs. A middle tier requires additional hardware. It requires support and maintenance agreements with the vendors. It requires middle tier software to be purchased. It requires a new set of skills to do middle tier development. It deals with different technology and different programming languages.
    Why? How can this approach be sensible when:
    - Oracle scales exceedingly well (and this scalability is not dependent on more h/w purchasing)
    - Oracle deals with a single programming language (PL/SQL)
    - Oracle supports high availability
    - Oracle supports redudancy
    - Oracle supports the complete application tier inside the database
    If you have problems now leveraging Oracle (as an application tier), then you will have more problems when doing it a middle layer. Why?
    Because the lack of experience/skill/knowledge required to make Oracle work for you, is not now suddenly negated and not needed when moving the application tier to Java.

  • Calling Managed CLR Stored Procedure from C++ SQL Server 2008 fails with Msg 2809

    I am trying to call a stored procedure from C++ (VS 2010).
    Here is what the stored procedure looks like:
    public class Validate
    [Microsoft.SqlServer.Server.SqlProcedure(Name = "ClientTest")]
    public static void ClientTest(out String res )
    { res = "50";}
    To create a stored procedure I deploy at first the assembly
    USE [test]
    GO
    CREATE ASSEMBLY ClientTestAssembly
    AUTHORIZATION testLogin
    FROM 'C:\Users\test\Documents\Visual Studio 2010\Projects\TestCreationAssemblyCSharp\TestCreationAssemblyCSharp\bin\x64\Debug\TestCreationAssemblyCSharp.dll'
    and call 
    USE test
    GO
    CREATE PROCEDURE ClientTest (@res NVARCHAR(40) OUTPUT)
    AS
    EXTERNAL NAME ClientTestAssembly.Validate.ClientTest
    I can call my procedure direct in SQL Server Management Studio without any errors
    declare @res nvarchar(10)
    execute ClientTest @res OUTPUT
    print @res
    But when I try to call this procedure from C++ using CALL syntax
    SQLBindParameter(sqlstatementhandle, 1, SQL_PARAM_OUTPUT, SQL_C_CHAR,
    SQL_VARCHAR , 40, 0, version, sizeof(version) ,
    &pcbValue);
    res = SQLExecDirect(sqlstatementhandle, (SQLCHAR*)("{CALL ClientTest(?) }"), SQL_NTS);
    I get the Error 2809 with SQLSTATE 42000 and with statement 
    The request for 'ClientTest'
    (procedure) failed because 'ClientTest' is a procedure object.
    However, if I wrap my CLR stored procedure into a T-SQL stored procedure, like
    CREATE PROCEDURE myProc (@res NVARCHAR(40) OUTPUT)
    AS
    EXEC ClientTest @res OUTPUT
    and call then myProc instead of ClientTest
    res = SQLExecDirect(sqlstatementhandle, (SQLCHAR*)("{CALL myProc(?) }"), SQL_NTS);
    everithing works fine and I get 50 as result.
    I have no ideas what is the reason for that behavior.
    Thanks very much for any suggestion. 
    Christina

    I'm not an ODBC expert, but you might try following the sample here:
    Process Return Codes and Output Parameters (ODBC)
    To see if it also behaves differently for your CLR proc.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Calling Oracle store procedure from Crystal 11 command

    I need to call Oracle store procedure from Crystal Command. The Store proc has ref cursor. Is it possible. Can you post few examples?
    Also, is it possible to have multiple sql statements in a Crystal Command, when working with Oracle 10g?
    It is working for SQL server.

    Please re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly.

  • Can we call a Java Stored Proc from a PL/SQL stored Proc?

    Hello!
    Do you know how to call a Java Stored Proc from a PL/SQL stored Proc? is it possible? Could you give me an exemple?
    If yes, in that java stored proc, can we do a call to an EJB running in a remote iAS ?
    Thank you!

    For the java stored proc called from pl/sql, the example above that uses dynamic sql should word :
    CREATE OR REPLACE PACKAGE MyPackage AS
    TYPE Ref_Cursor_t IS REF CURSOR;
    FUNCTION get_good_ids RETURN VARCHAR2 ;
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t;
    END MyPackage;
    CREATE OR REPLACE PACKAGE BODY MyPackage AS
    FUNCTION get_good_ids RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'MyServer.getGoodIds() return java.lang.String';
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t
    IS table_cursor Ref_Cursor_t;
    good_ids VARCHAR2(100);
    BEGIN
    good_ids := get_good_ids();
    OPEN table_cursor FOR 'SELECT id, name FROM TableA WHERE id IN ( ' &#0124; &#0124; good_ids &#0124; &#0124; ')';
    RETURN table_cursor;
    END;
    END MyPackage;
    public class MyServer{
    public static String getGoodIds() throws SQLException {
    return "1, 3, 6 ";
    null

  • Calling stored procedure from embedded sql

    I'm trying to call a stored procedure from embedded sql. I'm following the examples located in
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/a96109/pco06pls.htm#i9641
    I have the following section in my .pco file before precompiling.
    exec sql execute
    begin
    docs.grant_access_to_all_categories(:p_sam_id);
    end;
    end-exec.
    When running procob on the file with the above code I get the following error.
    Error at line 225, column 13 in file pco\docs_stored_procedures.pco
    exec sql execute
    ............1
    PCB-S-00576, PLS-201: identifier 'DOCS.GRANT_ACCESS_TO_ALL_CATEGORIES' must be d
    eclared
    Error at line 225, column 13 in file pco\docs_stored_procedures.pco
    exec sql execute
    ............1
    PCB-S-00576, PLS-0: Statement ignored
    Any ideas on what I am doing wrong on calling this stored procedure.

    I get the same error when trying to precompile sample11.pco from the demo directory in the oracle client software.
    Error at line 70, column 12 in file sample11.pco
    EXEC SQL EXECUTE
    ...........1
    PCB-S-00576, PLS-201: identifier 'EMP_DEMO_PKG.OPEN_CUR' must be declared
    Error at line 70, column 12 in file sample11.pco
    EXEC SQL EXECUTE
    ...........1
    PCB-S-00576, PLS-0: Statement ignored

  • Need help on processing XML doc using Java store procedure

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

  • Oracle Java Store Procedure and JNI

    Hi ! 'Is the anybody out there ?'
    We don't know. We are developing a java store procedure in Oracle 9i. We need to use a propetary .so file about cript/decript information (entrust file). So have to use in oracle a .jar file with all software infrastructure that use this .so file. But, we have a problem. 'Cause, in windows, we can use a .dll file from our java store procedure, but when we run under unix aix, we have problem about jni.
    java.library.path in oracle console is empty.
    So we cannot find our share object... have you got an idea ?
    thanks!!
    andrea

    Oracle lite does not support the use of PL/SQL procedures or triggers in the database, so unfortunately you just cannot use them.
    as an alternative you need to either
    a) include the setting on the client records when they are created
    b) use before insert/update triggers on the main oracle database to populate the columns. NOTE if doing this you will find that the user that is actually responsible for the inserts and updates to the main database is MOBILEADMIN (as it is running the apply process. If you just want to log the fact that it was client created fine, but will not tell you the creating user)
    c) you should be able to use pure java stored procedures on the client (if in the main oracle database, they should replicate across, but beware of jvm differences and any advanced stuff that may not be supported. you will also have to get any necessary jar files over to the client as well)
    We have used method a) as a standard method called for all inserts/updates in the java client APPLICATION software based on the existance of the audit columns, rather than within the database as it is simpler

  • Java Store Procedures

    Hi Guys,
    Does anyone know if it is possible to implement a java store procedure that will be subsequently called in a "select" operation within a "where" statement in Oracle 9R2?
    Thanks,
    Andrea

    Hi Andrea,
    From your sample code, I get the impression that you aren't too familiar
    with Oracle (and perhaps even databases in general?). This leads me
    to believe that you are looking for someone who will do your work for
    you. If that is the case, then I suggest you employ an independent
    contractor (or consultant) who, I'm sure, will be more than happy to
    accomodate you -- and I'm sure will do a much better job than I can
    (via this forum).
    Please forgive me if my interpretation is incorrect, however I feel,
    that with a little effort on your behalf, you can find the solutions
    to your problem by looking through the Oracle documentation, sample
    code and "how-to" documents that are available from Oracle's "Technet"
    web site:
    http://technet.oracle.com
    If, after that, you run into a specific problem, then please ask a
    specific question on this forum and I will try to provide a specific
    answer (if I can :-).
    Good Luck,
    Avi.

  • How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000

    Post Author: ltkin
    CA Forum: WebIntelligence Reporting
    Hi,
    How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000 ?
    Regards,

    Hi ltkin,
    Unfortunately, it is not possible in Xir2 to create Webi reports from stored procedures.
    Webi reports can only be created from Universe. So in Business Objects XIR3 we can create a special universe that enables Web Intelligence user's to access stored procedures residing in the database. This is the only way that Web Intelligence user's can access stored procedures.
    Please let me know if the above information helps.
    Regards,
    Pavan

  • Out of memory error when calling a java stored procedure multiple times

    Trying to run a PL/SQL loop calling a java stored procedure, I get the following error:
    "ORA-04030: out of process memory when trying to allocate 262188 byte callheap,ioc_allocate free)"
    (with some other error lines).
    The stored procedure does two major things:
    1) Open a socket to communicate with a server, of which it queries some data.
    2) Use JDBC (with the default DB connection it has, as a stored procedure) to write the results to a table.
    All socket connections, statements, etc. are properly closed and all memory should be garbage collected between each call.
    Can anyone offer an explanation or additional checks to make? I'm quite sure the code isn't causing the problem, since I've tried running it as a stand alone application (outside of Oracle) and didn't have any problems.
    Thanks.

    Hi,
    Verify that the database parameters are set correctly.
    EA

  • Is it possible to call a windows batch file from PL/SQL

    Hi gurus,
    Would require your help.Is it possible to call a windows batch file from PL/SQL??If yes can you give an example for the same or any workaround for the same.
    Regards
    Vijay

    Hi!
    Youn need some extproc related entries in you listener.ora and tnsnames.ora file.
    *1. In the listener.ora:*
    Defining the listener process is done in two parts.
    The information contained in each listener differs!!!
    The first part is as follows:
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))  <---  *ADD THIS LINE
          (ADDRESS = (PROTOCOL = TCP)(HOST = yourhostname)(PORT = 1521))
      )The seoncd part is as follows:
    SID_LIST_LISTENER =
      (SID_LIST = 
        (SID_DESC =
          (GLOBAL_DBNAME = YOUR_GLOBAL_DBNAME)
          (ORACLE_HOME = c:\oracle\product\10.2.0)  <-- THIS IS YOUR ORACLE_HOME
          (SID_NAME = YOUR_SID)                            <-- SID
        (SID_DESC =                                              <--- ADD THIS LINE
          (SID_NAME = PLSExtProc)                          <--- ADD THIS LINE
          (ORACLE_HOME = c:\oracle\product\10.2.0) <--- ADD THIS LINE AND EDIT TO YOUR ORACLE_HOME
          (PROGRAM = extproc)                                <--- ADD THIS LINE
          (ENV = "EXTPROC_DLLS=ANY")                  <--- ADD THIS LINE
        )                                                                <--- ADD THIS LINE
      )*2. In the tnsnames.ora you need to add the following entry:*
    *(The KEY value entered must be match to the KEY value entered int the listener.ora file!)*
    EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))
        (CONNECT_DATA =
          (SID = PLSExtProc)
          (PRESENTATION = RO)
      )Finally you need to restart your listiner. After restarting there will be a service called "PLSExtProc" in your listener.
    This are only examples for extproc configuration, your tnsnames.ora and listener.ora can be differs.
    FIRST MAKE MAKE A BACKUP OF YOUR ORIGINAL tnsnames.ora AND listener.ora FILES
    For more information please check metalink note 68061.1 "EXTPROC: Creating External Procedures on Windows NT"
    Bestr Regards
    Norbert

  • JAVA STORE PROCEDURE

    Hi all,
    My question is suppose my java store procedure tries to open an socket with an IP address/port number. What r the priviledges does the "USER" needs to run the procedure?
    If that priviledes has not grant to the user, then what will be the error should throw by Oracle?

    try the following :
    SYSTEM User needs to perform
    call dbms_java.grant_permission('CANDS_QA', 'java.util.PropertyPermission',
    '*','read,write');
    commit;
    then try your code again.
    null

  • Execute ORACLE STORE PROCEDURE from DATABASE

    Hi Everyone...
    i have a store procedure, it has a 5 params, 3 are IN parameters and 2 left are OUT parameters, I need execute this store procedure using a SQL Intruction like this
    DECLARE integracion_sia_kac PROCEDURE FOR KACTUS.SP_SIAKAC_NMDHODO
    :ll_horario,
    :ll_ide_doc,
    :ls_con_kac,
    @PINDREGI=:ls_ind_registro output, @PVALERRO=:ls_error_int output
    USING gt_kactus;
    i think this function is using from MSSQL Server, this has a three IN params but the declaration of the OUT params I don't understand.
    HELP ME!!!!!.... I need know way to execute the SP
    Thanks

    Well it is very simple!
    example:
    CREATE OR REPLACE PROCEDURE PROC1 (P1 IN NUMBER, P2 IN NUMBER, P3 OUT NUMBER) IS
    BEGIN
    P3 := P1 + P2;
    END;
    This is how to use PROC1 from, say, PROC2 :
    CREATE OR REPLACE PROCEDURE SomeShema.PROC2 IS
    Var1 NUMBER(15,2);
    Var2 NUMBER(15,2);
    ReturnParamFromPROC1 NUMBER(15,2);
    BEGIN
    Select SomeField INTO Var1 from Table1 where Table1.ID = 10;
    Select SomeField INTO Var2 from Table2 where Table2.ID = 20;
    PROC1(Var1, Var2, ReturnParamFromPROC1);
    DBMS_OUTPUT.PUT_LINE('Returned value from PROC1 is : '||ReturnParamFromPROC1);
    END;

  • ORA-28868 error when calling Web service over HTTPS from PL/SQL utl_http

    I am getting error message ORA-28868 error when calling Web service over HTTPS from PL/SQL utl_http PL/SQL package,
    when browsed through some of the messages they point to setting Oracle Wallet Manager.
    I am trying to connect
    Any idea on how to resolve this issue ?
    your input is appreciated.
    Thanks
    Ravi

    Duplicate post ... please ignore.

Maybe you are looking for

  • ODAC release 2 problem

    Hello everybody I have installed the new release of the ODAC, and each time we try to do a DataReader.Read() operation a OracleException is thrown without message and with the errorcode -1551. We can connect to the database, but we cannot perform any

  • Using the - key to stand for a string of characters

    If I am seraching for all the words that start with V,v and end with C,c. What is the best way to do this? I want to make - stand for [a-z and A-Z] so that the user could just enter something at the command-line such as V-C. But, I know if I do this

  • Create with Dynpro-Technology an  SAP Transaction

    Hello Experts! Imagine, I want to try create any SAP transaction lets say e.g. SalesDistribution's VA01 or any other transaction with the WebDynpro-Technology. In order to assure the 100 percent guarantee of correctly working of this transaction with

  • Batch Rename Raw Files After Import?

    Can you batch rename raw files after you import, so that the file name changes in Aperture and on the hard drive? I want to be able to edit images, and then rename only the keepers. This has been asked before here, but I could not find an answer. Tha

  • Unzipping of files

    i have created a program to unzip the zip files to the folder with the name of the zip file but it is extracting only when the contents inside is text files if the data inside is some other files if would give a error import java.io.BufferedReader; i