Java- Stored Procedure with Call by Result

Hi Oracle-Community,
I am looking for some example Code how to use a Java-Stored Procedure with Out-Parameters. Don't get me wrong. I dont want to call a Procedure with Out Parameters from Java (there are a lot of examples for this out there) . I just want to implement the Call by Result concept in a Java-Stored Procedure. A Client will call this Procedure with some parameters and the Java Procedure will fill them. So my first question: is this possible? And my second Question: How to implement it?
Greetings.

I found out a solution. It is very simple.
Just defining the parameters as java array (e.g. String[] P1). The first value (P1[0]) is the returned value.
At last just set in JDeveloper in the "Edit Method Signature" Dialog the parametermode to OUT.
The dialog can be found by rightclicking on the stored procedure in the dbexport file. You can read this
in Section 6 Publishing Java Classes With Call Specifications -> Setting Parameter Modes in
Oracle Database Java Developer's Guide.

Similar Messages

  • Is it possible to working in Java Stored Procedures with OCI driver?

    Hello ALL.
    Could you help me...
    Is it possible to working in Java Stored Procedures with OCI driver?
    I want to try to do some workaround...
    I need to work with following parametrs from Java Stored Procedures:
    DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
    String url = null;
    url = "jdbc:oracle:oci:@TEST";
    conn = DriverManager.getConnection (url,"scott","tiger");
    Is it possible?
    I tried but I have errors...
    Please, help me!
    Thanks

    You cannot call OCI functions directly from PL/SQL. You could, of course, write an external procedure that made OCI calls, though you could also write an external procedure in Java. I'm guessing the documentation is trying to convey this same information-- you would need an external procedure that used OCI if you wanted to use the old-school interfaces for LONG and LOB data types. If you converted to using LOBs rather than LONGs, you could do everything in PL/SQL.
    Justin

  • How to use stored procedure with many return results and variable with perl

    Hi everybody,
    i´m writtting now a Perl programm, wich use a oracle stored procedure with more than 1 result and 1 variable(I have to return 2 variable fpr each result). I don´t now how I can get it.I already search the web but I didn´t find.
    My example:
    PROCEDURE get_projects_and_sub_projects (
    v_project_id IN INTEGER,
    v_project_c_id OUT INTEGER,
    v_project_id_find OUT VARCHAR2
    IS
    BEGIN
    SELECT c_id, proj_id
    INTO
    v_project_c_id,
    v_project_id_find
    FROM t_projet
    WHERE t_projet .ksa_pro_art_kbz = 'KU'
    AND t_projet.proj_id LIKE v_project_id || '%';
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    v_project_c_id := NULL;
    v_project_id_find := NULL;
    WHEN OTHERS
    THEN
    kmessages.error (NULL,
    'get_projects_and_sub_projects',
    'Project-Name: ' || v_project_id,
    'Errornumber: '
    || SQLCODE
    || ' Error: '
    || SQLERRM,
    TRUE,
    TRUE
    raise_application_error (-20001,
    'Error '
    || SQLCODE
    || ' get_projects_and_sub_projects: '
    || SQLERRM,
    TRUE
    END get_projects_and_sub_projects;
    in Perl Program:
    sub get_projects_unterprojects_name($$){
    my ($db_handle, $proj_name_id) = @_; #$db_handle ist the DB Connection return value
    my $db_proj_c_id;
    my $db_proj_name;
    eval{ my $csr = $db_handle->prepare(q{
    BEGIN
    pro_doc_ber.get_projects_and_sub_projects(:proj_name_id, :db_proj_c_id, :db_proj_name);
    END;
    # parameter value
    $csr->bind_param(":proj_name_id", $proj_name_id);
    # return values
    $csr->bind_param_inout(":db_proj_c_id", \$db_proj_c_id, 11);
    $csr->bind_param_inout(":db_proj_name", \$db_proj_name, 20);
    $csr->execute(); };
    But this didn´t work. Could somebody give me some idea?
    Thank you
    Felx

    Some additional info would probably be helpful.
    What is your programming enviironment? Java?
    In any case I suspect that you will need to use the OCI to deal with specific Oracle types such as user defined object types -- thats not standard ANSI SQL.
    In Java I believe you need to use OPAQUE, there are some examples out there. I'm mostly a PL/SQL developer with some Java expereince so others here are more qualifed to answer your question more directly.

  • Java Stored Procedure with LOB as input parameter (oracle 9i 9.2.0.6)

    Hi,
    Is there a way to pass CLOB as input and output as part of java stored proceudre in oracle 9i (9.2.0.6)?
    I have to perform some data conversion on the CLOB data in java program and return the converted CLOB as output.
    --Ramesh Lokineni                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The reason why I want to use java for conversion is because, I want to perform base64 encoding decoding on the content stored in CLOB column. I tried to use by chunking the data into smaller pieces and apply the base64 encoding, but when I decode the CLOB using base64, I am not getting the same data. Later when I read about how base64 encoding happens I realized chunking the data in CLOB doesn't work. That's when I started to diggin how I can pass CLOB to java stored procedures.

  • Java Stored Procedures with 9.2.0.5

    We are attempting to create Java Stored Procedures and we receive the following errors when attempting to do so, not sure why this is happening
    C:\WSADWorkspaces\siscore\siscoreCore\source\com\amfam\siscore\integration\service>loadjava -user sis_user/is3l
    l@aw0u -oci8 -resolve MaintainService.class
    Error while creating JAVA$CLASS$MD5$TABLE
    ORA-01031: insufficient privileges
    Error while getting old MD5 of com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    Error while creating CREATE$JAVA$LOB$TABLE
    ORA-01031: insufficient privileges
    Error while deleting com/amfam/siscore/integration/service/MaintainTigerService from lob table
    ORA-00942: table or view does not exist
    Error while loading class com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    Error while creating class com/amfam/siscore/integration/service/MaintainTigerService
    ORA-29506: invalid query derived from USING clause
    Error while deleting MD5 of com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    Error while deleting MD5 of com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    The following operations failed
    class com/amfam/siscore/integration/service/MaintainTigerService: creation
    exiting : Failures occurred during processing
    C:\WSADWorkspaces\siscore\siscoreCore\source\com\amfam\siscore\integration\service>

    Jay,
    You ned to grant user sis_user permission to load java classes into the database. Please refer to the Java Developer's Guide which is part of the Oracle documentation and can be accessed via:
    http://tahiti.oracle.com
    Good Luck,
    Avi.

  • Issue with sending mail through java stored procedure in Oracle

    Hello
    I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
    Error:
    javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
    Code for creating java stored procedure: (T1 is the table created for debugging)
    ==================================================
    create or replace and compile java source named "MailUtil1" AS
    import java.util.Enumeration;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class MailUtil1 {
    public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
    String from, //sender mail id
    String fromPwd,//sender mail pwd
    String port,//587
    String to,//recepient email ids
    String cc,
    String subject,
    String messageBody) {
    try{
    Properties props = System.getProperties();
    props.put("mail.smtp.starttls.enable", "True"); // added this line
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.user", from);
    props.put("mail.smtp.password", fromPwd);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.auth", "true");
    #sql { insert into t1 (c1) values ('1'||:host)};
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    #sql { insert into t1 (c1) values ('2')};
    InternetAddress[] toAddress = new InternetAddress[1];
    // To get the array of addresses
    for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
    toAddress[i] = new InternetAddress(to);
    //System.out.println(Message.RecipientType.TO);
    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
    message.addRecipient(Message.RecipientType.TO, toAddress);
    if (cc!=null) {
    InternetAddress [] ccAddress = new InternetAddress[1];
    for(int j=0;j<ccAddress.length;j++){
    ccAddress[j] = new InternetAddress(cc);
    for (int j=0;j<ccAddress.length;j++){
    message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
    message.setSubject(subject);
    message.setText(messageBody);
    message.saveChanges();
    #sql { insert into t1 (c1) values ('3')};
    Enumeration en = message.getAllHeaderLines();
    String token;
    while(en.hasMoreElements()){
    token ="E:"+en.nextElement().toString();
    #sql { insert into t1 (c1) values (:token)};
    token ="ConTyp:"+message.getContentType();
    #sql { insert into t1 (c1) values (:token)};
    token = "Encod:"+message.getEncoding();
    #sql { insert into t1 (c1) values (:token)};
    token = "Con:"+message.getContent();
    #sql { insert into t1 (c1) values (:token)};
    Transport transport = session.getTransport("smtp");
    #sql { insert into t1 (c1) values ('3.1')};
    transport.connect(host, from, fromPwd);
    #sql { insert into t1 (c1) values ('3.2')};
    transport.sendMessage(message, message.getAllRecipients());
    #sql { insert into t1 (c1) values ('3.3')};
    transport.close();
    #sql { insert into t1 (c1) values ('4')};
    catch(Exception e){
    e.printStackTrace();
    String ex= e.toString();
    try{
    #sql { insert into t1 (c1) values (:ex)};
    catch(Exception e1)
    Edited by: user12050615 on Jan 16, 2012 12:18 AM

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • Java Stored Procedures make OS calls

    Can java stored procedures make calls to the operating system?

    If you grant the right privileges to the user executing them..
    (See the java developer guide for the details).
    Note that calls to the OS through System.getRuntime().execxxx will run as the oracle user on the server side, that's why you have to be able to grant the right privileges before doing it.

  • Java Stored Procedure SAXParser XML Schema Validation

    Using Oracle XML Developers Kit 10.2.0.2.0 - Production.
    Attempting to validate using XML Schema in a Java stored procedure with the code:
                   if ( schemaDoc == null )
                        // Obtain default connection
                        Connection conn = new OracleDriver().defaultConnection();
                        OraclePreparedStatement stmt = (OraclePreparedStatement) conn.prepareStatement("SELECT XmlDocObj FROM XmlDoc WHERE XmlDocNbr = 2");
                        OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
                        if ( rset.next() )
                             // get the XMLType
                             XMLType schemaXml = (XMLType)rset.getObject(1);
                             XSDBuilder builder = new XSDBuilder();
                             XMLSchema schemaDoc = (XMLSchema)builder.build(new InputSource(schemaXml.getInputStream()));
                   if ( inst == null )
                        inst = new ValidateCoreRequest();
                   ErrorHandlerImpl handler = inst.getNewErrorHandler();
    SAXParser saxParser = new SAXParser();
    saxParser.setXMLSchema(schemaDoc);
    saxParser.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    saxParser.setErrorHandler(handler);
    saxParser.parse(new InputSource(new StringReader(docStr)));
    if( handler.validationError )
                        errorMsg[0] = handler.saxParseException.getMessage().substring(0, Math.min(199, handler.saxParseException.getMessage().length()));
    Never reports validation errors in the XML. Although the XDK Programmers Guide states "...you can use
    the oracle.xml.parser.schema.XSDBuilder class to build an XML schema and
    then configure the parser to use it by invoking the XMLParser.setXMLSchema()
    method. In this case, the XML parser automatically sets the validation mode to
    SCHEMA_STRICT_VALIDATION and ignores the schemaLocation and
    noNamespaceSchemaLocation attributes." No validation seems to occur. I have tried to set an xsi:noNamespaceSchemaLocation attribute on the root XML node, but this results in URL errors if the URL is not valid or schema build errors if the URL is valid, but does not point to a real location.
    It appears that without a schema location attribute, no schema validation occurs. Using setXMLSchema() with a database source does not seem to cause the schema location attributes to be ignored. At least for Java stored procedures.
    Does XML Schema validation work in the database for externally referenced schemas?
    Thank You,
    Art

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jan Vissers ([email protected]):
    I have two schemas A and B. A contains a java stored procedure which calls a java stored procedure stored in B. Upon resolving the "A" Java Stored Procedures I get the following error:
    ORA-29545: badly formed class: at offset 3093 of Adapter.TFADPBeschikbaarheid.sendAanvraag expecting a class-oracle.xml.parser.v2.XMLDocument but encountered a class-oracle.xml.parser.v2.XMLDocument.
    ... Question:
    it is expecting something which it has in fact encountered... SO!!!! What is the error.
    Thx,
    Jan<HR></BLOCKQUOTE>
    Try this:
    Edit your XSU installation script located on lib directory of Oracle XSU's distribution:
    Find the line:
    loadjava -r -v -u $USER_PASSWORD xmlparserv2.jar
    Replace by:
    loadjava -r -v -g public -u $USER_PASSWORD xmlparserv2.jar
    And installs your Oracle XSU again.
    Best regards, Marcelo.

  • Oracle stored procedure to Java stored procedure

    Hello,
    I got a school assignement "Create a java stored procedure and call it out from JAVA program outside database".
    I've done it, but in case of JAVA stored procedure I have the procedure written in PL/SQL.
    PL/SQL procedure:
    CREATE OR REPLACE PROCEDURE getDogInfo
    (Dog_ID IN NUMBER, Dog_name OUT VARCHAR) AS
    BEGIN
      SELECT Name INTO Dog_name
      FROM Dog_family
      WHERE ID = Dog_ID;
    END;
    How do I convert it to JAVA stored procedure?
    Maybe it's just plain stupid and I should keep it as PL/SQL? I don't know if I have done it right.
    Also I don't know what to do with IN/OUT parameters in JAVA.

    Could my procedure java class look something like this? I am aware that I have to make a PL/SQL function that is associated with JAVA method CALL, just asking about JAVA Class at the moment.
    import java.sql.*;
    import java.io.*;
    public class Procedure {
      public static void getDogInfo (int Dog_ID, String Dog_name)
        throws SQLException
        { String sql =
          "SELECT Dog_name INTO Name FROM Dog_family WHERE ID = Dog_ID";
        try { Connection conn = DriverManager.getConnection("jdbc:default:connection:");
          PreparedStatement apstmt = conn.prepareStatement(sql);
          apstmt.setInt(1, Dog_ID);
          apstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
          ResultSet rset = apstmt.executeQuery();
          rset.close();
          apstmt.close(); //Connection close
        catch (SQLException e) {System.err.println(e.getMessage());
    My java program looks like this:
    package client;
    import java.sql.*;
    public class JDBCPiemers {
        static final String JDBC_DRIVER = "oracle.jdbc.OracleDriver";
        static final String DB_URL = "jdbc:oracle:thin:@localhost:1521:ORCL";
        static final String USER = "SYSTEM";
        static final String PASS = "asdasd";
        private String sql;
        public static void main(String[] args) throws ClassNotFoundException, SQLException {
            Connection conn = null;
            CallableStatement stmt = null;
            try {
                //Registering JDBC driver
                Class.forName("oracle.jdbc.driver.OracleDriver");
                System.out.println("Connecting to database ...");
                conn = DriverManager.getConnection(DB_URL, USER, PASS);
                System.out.println("Preparing command...");
                String SQL = "{CALL getDogInfo (?, ?)}";
                stmt = conn.prepareCall(SQL);
                int Dog_ID = 4;
                stmt.setInt(1,Dog_ID);
                stmt.registerOutParameter(2, java.sql.Types.VARCHAR);
                System.out.println("CALL of JAVA stored procedure ...");
                // Executing SQL
                stmt.execute();
                //Using getXXX method
                String Name = stmt.getString(2);
                System.out.println("Printing results ...");
                System.out.println("ID NR. " +Dog_ID + " is Dog with
    a name  '" + Name + "'" );      
                stmt.close();
                conn.close(); }
                catch(SQLException se) {
                    //JDBC Errors
                    se.printStackTrace(); }
                catch(Exception e) {
                    //Errors Class.forName
                    e.printStackTrace(); }
                finally {
                    //Clossing resurses
                    try {if(stmt!=null)
                    stmt.close(); }
                catch(SQLException se2) {}
                    try {if(conn!=null)
                    conn.close(); }
                    catch(SQLException se) {se.printStackTrace(); }
                    //finally block end
                } // try
                System.out.println("Closing program."); }}

  • Broken Java Stored Procedure Demo

    The link to download HotelBookingsSample.jar does not work. It is located on http://otn.oracle.com/sample_code/tech/java/jsp/samples/jsptrigger/Readme.html

    Do as follows:
    Define a JDBC Connection to your DB - use this name only.
    Create a Deployment profile (Java Stored Procedure )(with [x]Publish option) to the same connection.
    Then in the deployment tab of the Message View (View | Message View), you will see the deployment.
    Then you can call your procedures, functions using SQL*Plus by
    Expand Connection Folder
    Right Click on the JDBC Connection
    Select Invoke SQL*Plus...
    This will invoke SQL*Plus with the info from this connection.
    In SQL*Plus enter various statements to invoke your Java Stored Procedure.
    For grins, try:
    In JDeveloper, select
    File | New ... Class / JavaStoredProcedure
    Add the following methods to the bottom:
    =============
    public static String getJDBTime( ) {
    return (new Date()).toString();
    private static int nSeq = 0;
    public static int getNextSequence( ) {
    return nSeq++;
    ===========
    Then Create a deployment profile and deploy it.
    Then Invoke SQL*Plus and call it as:
    select <PackageName>.FunctionName() from dual;
    In my case, my SQL*Plus window looked as:
    SQL>
    SQL>
    SQL> select MYPROJECT5.GETJDBTIME() from dual;
    MYPROJECT5.GETJDBTIME()
    Wed Dec 20 16:12:16 CST 2000
    SQL> select MYPROJECT5.GETJDBTIME() from dual;
    MYPROJECT5.GETJDBTIME()
    Wed Dec 20 16:12:22 CST 2000
    SQL> select MYPROJECT5.GETNEXTSEQUENCE() from dual;
    MYPROJECT5.GETNEXTSEQUENCE()
    0
    SQL> select MYPROJECT5.GETNEXTSEQUENCE() from dual;
    MYPROJECT5.GETNEXTSEQUENCE()
    1
    SQL> select MYPROJECT5.GETNEXTSEQUENCE() from dual;
    MYPROJECT5.GETNEXTSEQUENCE()
    2
    SQL>
    I hope this helps,
    -John
    null

  • Java stored procedure problem(oracle db)

    HI,
    we have a java stored procedure with the following definition, and that works as we want it to:
    CREATE OR REPLACE FUNCTION processBulletin(in_varchar VARCHAR2) RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'JavaParser.Bufr_Ingest.processBulletin(java.lang.String) return java.lang.String';
    And the Java portion:
    public static String processBulletin(String in_bull)
    ... do something with in_bull
    The problem is that we've recently discovered that the 32767 size restiriction on the input parameter varchar2 is too small. I don't want to rewrite the entire Java procedure. I figured the simplest (or at least temporary)solution would be to have the Java procedure accept a CLOB, convert that clob to a string and continue as it would. I was hoping someone might be able to tell me if the following would be possible:
    CREATE OR REPLACE FUNCTION processBulletin(in_clob CLOB) RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'JavaParser.Bufr_Ingest.processBulletin(oracle.sql.CLOB) return java.lang.String';
    And the Java portion:
    public static String processBulletin(oracle.sql.CLOB in_clob)
    String in_bull = clob_in.getSubString(1, (int)clob_in.length());
    ... do something with in_bull
    Thanks

    I don't know about Java stored procedures, but in JDBC you usually use streams to work with CLOBS. Here's Oracle JDBC Developers Guide, Working with LOBs

  • T-sql 2008 r2 place results from calling a stored procedure with parameters into a temp table

    I would like to know if the following sql can be used to obtain specific columns from calling a stored procedure with parameters:
    /* Create TempTable */
    CREATE TABLE #tempTable
    (MyDate SMALLDATETIME,
    IntValue INT)
    GO
    /* Run SP and Insert Value in TempTable */
    INSERT INTO #tempTable
    (MyDate,
    IntValue)
    EXEC TestSP @parm1, @parm2
    If the above does not work or there is a better way to accomplish this goal, please let me know how to change the sql?

    declare @result varchar(100), @dSQL nvarchar(MAX)
    set @dSQL = 'exec @res = TestSP '''+@parm1+''','' '''+@parm2+' '' '
    print @dSQL
      EXECUTE sp_executesql @dSQL, N'@res varchar(100) OUTPUT', @res = @result OUTPUT
    select @result
    A complicated way of saying
    EXEC @ret = TestSP @parm1, @parm2
    SELECT @ret
    And not only compliacated, it introduces a window for SQL injection.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Calling Stored Procedure with Paramters in Java

    Hi
    I havent done alot of sql/java work so I'm wondering if I could get some help.
    I have the java code
    private void processPatient(Element pat)
    throws PatientException,
    ParseException,
    SQLException,
    Exception {
    Connection con = null;
    ResultSet rs;
    CallableStatement cs;
    ...<code>
    cs = con.prepareCall("{call updt_pat.set_pat_ppe}");
    rs = cs.executeQuery();
    Does this look correct? The proc updt_pat.set_pat_ppe also takes an int parameter...how would I modify this to accept the paramter? Like
    cs = con.prepareCall("{call updt_pat.set_pat_ppe paramter}");
    Thanks for the help!!
    Mani

    The actual implementation of what the setInt does and how it does it is up the JDBC driver vendor. Basically its function is as follows (implementation will be driver specific) it takes the int value and passes it to the Stored Procedure being called as the (in this case) 1st input parameter expected by the stored procedure. Whatever the name of the IN variable is within the stored procedure is irrelevant to the JDBC code, basically it will be assigned to the name of the first IN parameter within the Stored Procedure.
    The error you are reporting:
    xxx.java:272: cannot resolve symbol
    symbol : method setInt (java.lang.Integer,int)
    location: interface java.sql.CallableStatement
    cs.setInt(1, ppath.getPatId());
    ^
    1 error
    is interesting as it is claiming that the setInt method requires as its first argument an Integer object - this is not what the specification requires, it just wants an index number as a Java int:
    setInt(int index, int value), note no java.lang.Integer
    maybe this is a driver specific implementation?
    Try the following (not in any specific order):
    1 - int value = ppath.getPatId();
    cs.setInt(1, value);
    2 - Integer index = new Integer(1);
    cs.setInt(index , ppath.getPatId());
    3 - int = ppath.getPatId();
    Integer index = new Integer(1);
    cs.setInt(index , value);
    Let me know if this solves your problem.

  • 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

  • Applying an XSLT against results from XSU in Java Stored Procedure

    Is there an easy way to have a Java Stored Procedure apply an XSLT against the results of an OracleXMLQuery? The only examples I can find are with regular Java code outside the database.
    I'm running 9.2.0.2 on Windows 2000 Server.

    This is what I use:
    (I have table called params where I have stored encodinf, XSL, and stuff like that)
    DOMParser parser;
    XMLDocument xml, xsldoc, outXML;
    URL xslURL;
    URL xmlURL;
    Connection conn = getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset= stmt.executeQuery("select xsl_varchar2,encoding,version,host,port,host_path,usrnm,passwrd from params");
    rset.next();
    String strXSL=rset.getString(1); //This is XSL transformation
    String strEncoding=rset.getString(2);
    String strVersion=rset.getString(3);
    rset.close();
    stmt.close();
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    StringReader rXSL= new StringReader(strXSL);
    xslURL=createURL("test");
    parser.parse(rXSL);
    xsldoc=parser.getDocument();
    OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from somewhere");
    xml=(XMLDocument) qry.getXMLDOM();
    // instantiate a stylesheet
    XSLStylesheet xsl = new XSLStylesheet(xsldoc, xslURL);
    XSLProcessor processor = new XSLProcessor();
    // display any warnings that may occur
    processor.showWarnings(true);
    processor.setErrorStream(System.err);
    // Process XSL
    DocumentFragment result = processor.processXSL(xsl, xml);
    // create an output document to hold the result
    outXML = new XMLDocument();
    outXML.setVersion(strVersion);
    outXML.setEncoding(strEncoding);
    outXML.appendChild(result);
    outXML is your XML.

Maybe you are looking for