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.

Similar Messages

  • Calling Stored Procedure with a DATE input parameter

    Hi. A question about Date input parameters when calling a stored procedure...
    I have a procedure that takes a DATE parameter as input. I would like that DATE value to include a Time element.
    My Application Module method takes an input parameter as java.util.Date (myParamDate) - which will preserve a time element(?).
    However when I create the CallableStatement, I'm trying to set the parameter using setDate like this (for param 5):
                st = getDBTransaction().createCallableStatement("begin cs_my_pck.request_values(?,?,?,?,?,?,?,?); end;", 0);           
                Connection myConn = st.getConnection();
                ArrayDescriptor myArrDesc  =  ArrayDescriptor.createDescriptor("CS_FIELD_TABT", myConn);
                Array sqlParamNameArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramNames.toArray());
                Array sqlParamValueArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramValues.toArray());
                Array sqlFilterNameArray = new oracle.sql.ARRAY(myArrDesc,myConn,filterNames.toArray());
                st.setString(1, repType);
                st.setObject(2, sqlParamNameArray);
                st.setObject(3,sqlParamValueArray);
                st.setObject(4,sqlFilterNameArray);
                java.sql.Date myRepDate = new java.sql.Date(myParamDate.getTime());
                st.setDate(5,myRepDate);
                System.out.println("Report Date = " + myRepDate.toString());
                st.setString(6,repUser);
                st.setString(7,repAttach);
                // set out param
                st.registerOutParameter(8, Types.NUMERIC);
                st.execute();I understand java.sql.Date does NOT include a Time element. But setDate() accepts only a java.sql.Date so my procedure parameter ends up with a zero time element.
    How do I call this procedure retaining the Time element?
    Thanks.

    It includes time element, if you want more precision go with timestamp.
    http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html

  • 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.

  • 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

  • Stored procedure with cursor as out parameter

    Can any one help me by showing how to write a procedure with cursor as out parameter and caputuring it in java using jdbc.
    Thanks in advance,
    shravan bharadwaj

    I know that in the SQLJ distribution (which is also downloadable) there is an example in the demo directory called RefCursDemo that shows the SQL code and how to call it - albeit from SQLJ and not JDBC. There may also be a demo in the JDBC distribution, though I am not sure about that.

  • 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.

  • Call from Java Plsql Procedure with VArray as Out Parameter

    Hi,
    I have a Java web application(Tomcat server) that call a plsql procedure with Varray as OUT parameter.
    The Plsql code is perfectly compiled.
    When i run the application, I get the following error msg in my Tomcat window:
    java.sql.SQLException: ORA-06530: Reference to uninitialized composite
    ORA-06512: at "SEMS1.PACK_SEMSADMIN_OFFEREDJOBS", line 102
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:109
    3)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
    {color:#0000ff}
    Doubt: Do I need to declare ArrayDescriptors to retrieve the VArray from the Plsql procedure.
    I think the below statement is enough; we need ArrayDescriptors only when we we wish to send a Plsql Object or Varray from Java code to the procedure. Plz correct me if not so.
    dbCallableStatement.execute();
    ARRAY SimpleOUTArray = (ARRAY) ((OracleCallableStatement) dbCallableStatement).
    getObject(Integer.parseInt(arlParameterOutIndex.get(i).toString()));{color}
    I am unable to realize where the mistake is?
    {color:#800000}
    {color}{color:#800000}
    VARRAY AND PROC DETAILS:
    TYPE STRUCT_JOB_DETAILS AS OBJECT
    APPL_NO NUMBER (10),
    S_FNAME VARCHAR2 (32 Byte),
    S_MI VARCHAR2 (32 Byte),
    S_LNAME VARCHAR2 (32 Byte),
    APPL_DATE DATE,
    DESCRIPTION VARCHAR2 (100 Byte),
    S_UCID VARCHAR2 (8 Byte)
    TYPE VARRAY_JOB_DETAILS IS VARRAY(100) OF STRUCT_JOB_DETAILS;{color}
    {color:#800000}PROCEDURE:{color}
    {color:#800000}CREATE OR REPLACE PACKAGE PACK_SEMSADMIN_OFFEREDJOBS
    AS
    TYPE Generic_Cursor_Type IS REF CURSOR;
    --TYPE varray_job_detail is VARRAY(100) OF STRUCT_JOB_DETAILS;
    --va_varray_job_detail varray_job_detail := varray_job_detail();
    va_varray_job_detail VARRAY_JOB_DETAILS := VARRAY_JOB_DETAILS();
    PROCEDURE Admin_Jobs_Offered_Rtr
    ic_status IN VARCHAR2,
    or_offered_jobs OUT Generic_Cursor_Type,
    va_varray_job_detail OUT VARRAY_JOB_DETAILS
    CREATE OR REPLACE PACKAGE BODY PACK_SEMSADMIN_OFFEREDJOBS
    AS
    PROCEDURE Admin_Jobs_Offered_Rtr
    ic_status IN VARCHAR2,
    or_offered_jobs OUT Generic_Cursor_Type,
    va_varray_job_detail OUT VARRAY_JOB_DETAILS
    AS
    vc_query VARCHAR2(15000) := '';
    vc_query_1 VARCHAR2(15000) := '';
    counter NUMBER := 1;
    vc_no NUMBER := 0;
    or_applicants_list Generic_Cursor_Type;
    TYPE type_appln_list IS RECORD
    job_no NUMBER(10),
    job_title VARCHAR2(50 BYTE),
    account_no VARCHAR2(10 BYTE),
    head_fname VARCHAR2(32 BYTE),
    head_minitial VARCHAR2(10 BYTE),
    head_lname VARCHAR2(32 BYTE),
    num NUMBER
    vn_appln_list type_appln_list;
    TYPE type_job_offered IS RECORD
    APPL_NO NUMBER (10),
    S_FNAME VARCHAR2 (32),
    S_MI VARCHAR2 (32),
    S_LNAME VARCHAR2 (32),
    APPL_DATE DATE,
    DESCRIPTION VARCHAR2 (100),
    S_UCID VARCHAR2 (8)
    vn_job_offered type_job_offered;
    BEGIN
    vc_query := vc_query || ' SELECT jobs.job_no,job_title, account_no, head_fname, head_minitial, head_lname, num';
    vc_query := vc_query || ' FROM jobs, ( ' ;
    vc_query := vc_query || ' SELECT jobs.job_no,count(*) as num' ;
    vc_query := vc_query || ' FROM student_apps ,jobs ' ;
    vc_query := vc_query || ' WHERE jobs.job_no = student_apps.job_no' ;
    vc_query := vc_query || ' AND (student_apps.status in (''o'',''t'')) '; --|| ic_status || ')' ;
    vc_query := vc_query || ' AND jobs.status not in (''z'', ''Z'')' ;
    vc_query := vc_query || ' GROUP BY jobs.job_no' ;
    vc_query := vc_query || ' ) no_apps_off' ;
    vc_query := vc_query || ' WHERE jobs.job_no = no_apps_off.job_no' ;
    dbms_output.put_line('Executed Query_1');
    va_varray_job_detail := VARRAY_JOB_DETAILS();
    va_varray_job_detail.extend(100);
    OPEN or_offered_jobs FOR vc_query;
    LOOP
    FETCH or_offered_jobs INTO vn_appln_list;
    EXIT WHEN or_offered_jobs%NOTFOUND;
    vc_query_1 := '';
    vc_query_1 := vc_query_1 || ' SELECT stud_apps.appl_no APPL_NO, stud_apps.s_fname S_FNAME, ';
    vc_query_1 := vc_query_1 || ' stud_apps.s_mi S_MI, stud_apps.s_lname S_LNAME, ';
    vc_query_1 := vc_query_1 || ' stud_apps.appl_date APPL_DATE, look_up.description DESCRIPTION, ' ;
    vc_query_1 := vc_query_1 || ' stud_apps.s_ucid S_UCID ' ;
    vc_query_1 := vc_query_1 || ' FROM student_apps stud_apps,jobs jbs,lookup look_up' ;
    vc_query_1 := vc_query_1 || ' WHERE stud_apps.status in (''o'',''t'') '; --(' || ic_status || ') ' ;
    vc_query_1 := vc_query_1 || ' AND jbs.job_no = stud_apps.job_no' ;
    vc_query_1 := vc_query_1 || ' AND jbs.status not in (''z '', ''Z'')' ;
    vc_query_1 := vc_query_1 || ' AND stud_apps.status = look_up.code ' ;
    vc_query_1 := vc_query_1 || ' AND look_up.type = ''st''' ;
    vc_query_1 := vc_query_1 || ' AND stud_apps.job_no = ''' || vn_appln_list.job_no || ''' ' ;
    vc_query_1 := vc_query_1 || ' ORDER BY appl_date' ;
    dbms_output.put_line('Executed Query_2');
    OPEN or_applicants_list FOR vc_query_1;
    LOOP
    FETCH or_applicants_list INTO vn_job_offered;
    EXIT WHEN or_applicants_list%NOTFOUND;
    va_varray_job_detail(counter).APPL_NO := vn_job_offered.APPL_NO;
    va_varray_job_detail(counter).S_FNAME := vn_job_offered.S_FNAME;
    va_varray_job_detail(counter).S_MI := vn_job_offered.S_MI;
    va_varray_job_detail(counter).S_LNAME := vn_job_offered.S_LNAME;
    va_varray_job_detail(counter).APPL_DATE := vn_job_offered.APPL_DATE;
    va_varray_job_detail(counter).DESCRIPTION := vn_job_offered.DESCRIPTION;
    va_varray_job_detail(counter).S_UCID := vn_job_offered.S_UCID;
    counter := counter + 1;
    END LOOP; --end of FOR
    CLOSE or_applicants_list;
    END LOOP; -- end of FETCH
    END Admin_Jobs_Offered_Rtr;
    END PACK_SEMSADMIN_OFFEREDJOBS;
    /{color}
    Reqire help plzzzz !!!
    Thanks.

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • Java call stored procedure with nested table type parameter?

    Hi experts!
    I need to call stored procedure that contains nested table type parameter, but I don't know how to handle it.
    The following is my pl/sql code:
    create or replace package test_package as
    type row_abc is record(
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    type matrix_abc is table of row_abc index by binary_integer;
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    END test_package;
    create or replace package body test_package as
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    IS
    v_sn NUMBER(8):=0 ;
    BEGIN
    LOOP
    EXIT WHEN v_sn>5 ;
    v_sn := v_sn + 1;
    p_out(v_sn).col1 := 'col1_'||to_char(v_sn)|| p_arg1 ;
    p_out(v_sn).col2 := 'col2_'||to_char(v_sn)||p_arg2 ;
    p_out(v_sn).col3 := 'col3_'||to_char(v_sn)||p_arg3 ;
    END LOOP ;
    END ;
    END test_package ;
    My java code is following, it doesn't work:
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection
    ("jdbc:oracle:thin:@10.16.102.176:1540:dev", "scott", "tiger");
    con.setAutoCommit(false);
    CallableStatement ps = null;
    String sql = " begin test_package.test_matrix( ?, ? , ? , ? ); end ; ";
    ps = con.prepareCall(sql);
    ps.setString(1,"p1");
    ps.setString(2,"p2");
    ps.setString(3,"p3");
    ps.registerOutParameter(4,OracleTypes.CURSOR);
    ps.execute();
    ResultSet rset = (ResultSet) ps.getObject(1);
    error message :
    PLS-00306: wrong number or types of arguments in call to 'TEST_MATRIX'
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    Regards
    Louis

    Louis,
    If I'm not mistaken, record types are not allowed. However, you can use object types instead. However, they must be database types. In other words, something like:
    create or replace type ROW_ABC as object (
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    create or replace type MATRIX_ABC as table of ROW_ABC
    /Then you can use the "ARRAY" and "STRUCT" (SQL) types in your java code. If I remember correctly, I recently answered a similar question either in this forum, or at JavaRanch -- but I'm too lazy to look for it now. Do a search for the terms "ARRAY" and "STRUCT".
    For your information, there are also code samples of how to do this on the OTN Web site.
    Good Luck,
    Avi.

  • With JDBC, calling a stored procedure with ARRAY as out parameter

    Hi,
    I want to use the data type ARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
    my java program using JDBC.
    The problem it's i use a 8.1.7 client to acces with oci to a 7.1.3 Database.
    With this configuration I can get back a Cursor but not an Array.
    Does it's possible ?
    Thanks for your help !
    Michakl

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • Calling stored procedure with struct and boolean parameter

    Hi all,
    I am trying to write an EJB method using eclipselink that has to call a stored procedure which has the following parameters:
    - an object type (in/out)
    - a date (in)
    - another date (in)
    - a boolean (optional, in)
    - a number (out)
    - a string (out)
    When using StoredProcedureCall, I succeed in passing the dates and the object type (as a STRUCT) into the procedure and read out the output variables. I can also do this using NamedStoredProcedureCall and only map the number and string in a result class. Drawbacks of NamedStoredProcedureCall:
    - I cannot map the object type that comes back out (working example, anyone?)
    - I cannot specify the boolean input variable
    The problem is when I want to specify the boolean. In StoredProcedureCall, this is not possible since this only accepts native JDBC parameters. So I tried our PLSQLStoredProcedureCall.
    Here, I can specify all in/out parameters except the object type! No matter what I try, I seem to end up with ORA-3115 - unsupported network datatype or representation. Does anyone have a working example on how to use this?
    Regards,
    Jeroen van Veldhuizen
    REDORA B.V.

    The problem is not that I want to pass in a boolean. When I try to use PLSQLStoredProcedure, I do not succeed in passing in/out an object type (or STRUCT). It looks like the code has been made to access PLSQL record and table types by wrapping them in an object type, but it seems not to be possible to to use an object type directly.
    To start with: when you create a STRUCT parameter, the generated sql code is this:
    DECLARE
      l_param_in STRUCT := :1;and since struct is not a datatype, this fails.
    Jeroen

  • Calling a stored procedure with array as IN parameter

    Hi,
    I need to invoke a stored procedure which actually requires 2 IN parameters , both are ARRAY of numbers.. Can anyone tell me using JDBC callableStatement how to invoke this stored procedure?
    how to pass array of numbers as input to stored procedure? also what is the corresponding JAVA data type?
    the procedure definition is as follows:
    PROCEDURE update_group
    ( in_username IN consumers.consumer_name%type,
    in_group_id IN account_group.acct_grp_id%type,
    in_group_name IN account_group.acct_grp_dsply_nm%type,
    in_group_type IN account_group.acct_group_type_cd%type,
    in_rem_accts_arr IN number_array,
    in_add_accts_arr IN number_array,
    out_over_max_ind OUT integer);
    thanks in advance

    Hi,
    You need to define a Call Spec like the following (assume NVarrayClass class):
    create or replace procedure nvaproc (x IN OUT number, y IN OUT
    NVARRAY,
    z IN NVARRAY)
    as language java
    name 'NVarrayClass.nvaproc(oracle.sql.NUMBER[], java.sql.Array[],
    java.sql.Array)';
    show errorsI have tons of examples of array in chapter 3 and 8 of my book. The code depot is available @ http://books.elsevier.com/companions/1555583296?country=United+States
    Kuassi http://db360.blogspot.com

  • Calling a stored procedure with VARRAY as out parameter using JDBC

    Hi,
    I want to use the data type VARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
    my java program using JDBC.
    I'm using Oracle 8.1.5 for Windows NT.
    Please help me.
    Thanks
    Sumanta
    null

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • Database Adapter calling stored procedure with xmlDOM.DOMNODE input problem

    Hi all,
    I have been asked to do a POC on using SOA suite to generate a web-service for several database stored procedure. A few of them can be done without a fuss. But I am now stuck with a stored procedure that has input and output as xmlDOM.DOMNODE type.
    The stored procedure is very simple as below:
    procedure prc_accinquiry(request in xmlDOM.DOMNODE, response out xmlDOM.DOMNODE) is
    begin
    response := request;
    end prc_accinquiry;
    I get the following error
    Error while writing wsdl file C:/JDeveloper/mywork/ABSPOC/NetBanking/DomNodeTestDB.wsdl. Exception: WSDLException: faultCode=OTHER_ERROR: The wrapper procedure, PACK_TESTING$PRC_ACCINQUIRY, could not be found in the package, BPEL_DOMNODETESTDB, for the schema, MBTT
    Did I do something wrong? or DOMNODE is not part of supported datatype for DB Adapter stored procedure call from JDeveloper?
    The environment is SOA suite 11g 11.1.1.5 with Database 11 XE
    Thank you in advance,
    Jomphop
    Edited by: e-Teoy on 15/12/2011 19:49

    This problem can be resolved by granting execute permission on the object type to the caller. For example, if the stored procedure is in schema1 and the object type is in schema2 then you would connect as schema2 and execute
    SQL> grant execute on <object type> to schema1
    Referencing object types defined in other schemas is documented. This is the described method for accessing object types in other schemas.

  • Stored procedure with IN and OUT parameter

    HI all,
    here is code example
    declare
             in_dt date  := '1-feb-2010' ;
    col1 ...;
    col2 ...;
    col3 ...;       
    begin
      select e.*
      into col1,
            col2,
            col3
      from table_xyz e
      where e.start_dt  = in_dt;
    end;
    How do i convert the above code into stored procedure by accepting "in_dt" as IN parameter and getting the result set displayed (output) through OUT parameter say "cur_out" (OUT paramter)
    Thank you so much !!! I really appriciate it !!

    i ran my procedure which is very similar syndra posted
    create or replace procedure foo(p_dt in date, cv out sys_refcursor) as
    begin
    open cv for
    select e.*
    from table_xyz e
    where start_dt = p_dt;
    end;
    /Here is how is executed
    DECLARE
      P_DT DATE;
      CV SYS_REFCURSOR;
    BEGIN
      P_DT := '10-oct-2005';
      -- CV := NULL;  Modify the code to initialize this parameter
      scott.foo ( P_DT, CV );
      COMMIT;
    END;           
    -- i get PL/SQL procedure successfully complted , But i dont see the result set Or output
    - How do i see the output when i m using refcursor ?? i tried using print , but nothing didnt work
    - Any idea ??
    Thank you!!
    Edited by: user642297 on Jun 24, 2010 1:35 PM

  • Calling a procedure with a CLOB input parameter

    All,
    I trying to execute a simple stored procedure that can accept the text of another stored procedure as an input argument. The text of the stored procedure could exceed size allowable under plsql varachar2, so I typed this as a clob..
    Problem is the system hangs when I call this stored procedure. I am able to use varchar2 for the input code.. and this works, but using clob just causes the client (sqlplus, sqlDeveloper) to hang..
    Database version 10.2.0.4
    Any assistance would be greatly appreciated.. I suspect an Oracle bug but I could use some guidance before I hit up support..
    thanks Badri..
    DECLARE
    PROC_NAME VARCHAR2(200);
    INPUT_CODE CLOB;
    RESULT VARCHAR2(200);
    BEGIN
    PROC_NAME := 'TESTHANG';
    INPUT_CODE := '(input IN VARCHAR2)' || CHR(9) || ' AS BEGIN NULL;' || CHR(9) || 'END;'
    FWK_CREATE_PROCEDURE(
    PROC_NAME => PROC_NAME,
    INPUT_CODE => INPUT_CODE,
    RESULT => RESULT
    DBMS_OUTPUT.PUT_LINE('RESULT = ' || RESULT);
    END;
    create or replace PROCEDURE FWK_CREATE_PROCEDURE
    (proc_name IN VARCHAR2,
    input_code IN CLOB,
    result OUT NOCOPY VARCHAR2)

    Hi, Badri,
    badrinathg wrote:
    All,
    I trying to execute a simple stored procedure that can accept the text of another stored procedure as an input argument. The text of the stored procedure could exceed size allowable under plsql varachar2, so I typed this as a clob..
    Problem is the system hangs when I call this stored procedure. I am able to use varchar2 for the input code.. and this works, but using clob just causes the client (sqlplus, sqlDeveloper) to hang..Are you sure the code you posted is what you're running? It's missing a semicolon, which would cause a compile error, regardless of whether input_code was a CLOB or a VARCHAR2.
    Database version 10.2.0.4
    Any assistance would be greatly appreciated.. I suspect an Oracle bug but I could use some guidance before I hit up support..
    thanks Badri..
    DECLARE
    PROC_NAME VARCHAR2(200);
    INPUT_CODE CLOB;
    RESULT VARCHAR2(200);
    BEGIN
    PROC_NAME := 'TESTHANG';
    INPUT_CODE := '(input IN VARCHAR2)' || CHR(9) || ' AS BEGIN NULL;' || CHR(9) || 'END;'
    FWK_CREATE_PROCEDURE(
    PROC_NAME => PROC_NAME,
    INPUT_CODE => INPUT_CODE,
    RESULT => RESULT
    DBMS_OUTPUT.PUT_LINE('RESULT = ' || RESULT);
    END;Please format any code that you post, and type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing on this site.
    Compile the procedure first.  The procedure has to exist before the anonymous block will compile.
    create or replace PROCEDURE FWK_CREATE_PROCEDURE
    (proc_name IN VARCHAR2,
    input_code IN CLOB,
    result OUT NOCOPY VARCHAR2)It looks like the rest of the procedure got cut off.
    The following works fine for me:create or replace PROCEDURE FWK_CREATE_PROCEDURE
    ( proc_name     IN     VARCHAR2,
    input_code     IN     CLOB,
    result     OUT NOCOPY VARCHAR2
    IS
    BEGIN
         result := 'Hello, world!';
    END     fwk_create_procedure;
    SHOW ERRORS
    DECLARE
         PROC_NAME     VARCHAR2(200);
         INPUT_CODE     CLOB;
         RESULT          VARCHAR2(200);
    BEGIN
         PROC_NAME := 'TESTHANG';
         INPUT_CODE := '(input IN VARCHAR2)' || CHR(9)
                             || ' AS BEGIN NULL;'
                             || CHR(9)
                             || 'END;';          -- Need ; at end
         FWK_CREATE_PROCEDURE (
                   PROC_NAME     => PROC_NAME,
                   INPUT_CODE     => INPUT_CODE,
                   RESULT          => RESULT
         DBMS_OUTPUT.PUT_LINE ('RESULT = ' || RESULT);
    END;
    Edited by: Frank Kulash on Sep 23, 2010 4:20 PM
    I see you posted some more code.
    Whenever you write a loop, include a call to dbme_output.put line inside the loop, so see how it's progressing.
    If it's an infinite loop, the calls to put_line will eventually cause the buffer to overflow, and the output may help you solve the problem.
    I added a call to put_line at the end of the loop:...     LOOP
              next_delim := INSTR (input_code, delim, pos);
              source_code := source_code || SUBSTR(input_code, pos, next_delim - pos) || CHR(13) || CHR(10);
              pos := next_delim + 1;
              EXIT WHEN pos >= str_length;
              dbms_output.put_line (pos || ' = pos inside loop in FWK_CREATE_PROCEDURE');     -- NEW
         END LOOP;
    and got this output:21 = pos inside loop in FWK_CREATE_PROCEDURE
    37 = pos inside loop in FWK_CREATE_PROCEDURE
    1 = pos inside loop in FWK_CREATE_PROCEDURE
    21 = pos inside loop in FWK_CREATE_PROCEDURE
    37 = pos inside loop in FWK_CREATE_PROCEDURE
    1 = pos inside loop in FWK_CREATE_PROCEDURE
    21 = pos inside loop in FWK_CREATE_PROCEDURE
    37 = pos inside loop in FWK_CREATE_PROCEDURE
    1 = pos inside loop in FWK_CREATE_PROCEDURE
    Maybe the condition for ending the loop should be:...          EXIT WHEN pos >= str_length
              OR pos = 1;
    Remember to comment out (or delete) the call to put_line before moving the code to Production.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Remote Desktop 'Connection Refused'

    Modem/Router Model: GT704-WG-B Firmware Version: 30.17.0 (Red background) Operating System:  Windows 7 Enterprise Here is what I have set up to allow me access from outside my network via RDP. Router config: Security > Applications "RDP" Rule Applied

  • How do I import video from iphone to my desktop?

    I would like to import a video from my iphone to my desktop to edit in quicktime converting video format for youtube upload. How do I do this?

  • Why is iTunes trying to sync deleted items to iPhone?

    Hi, I own a MacBook Pro and an iPhone 4. When attempting to sync my music, iTunes tries to sync particular items twice. The result is that the second time it tries to sync it fails, and it results in a message "x items could not be synced see itunes

  • Going to buy LE7. Can anyone recommend an interface?

    Hello. I was using a windows PC with a free version of Cubase and the tascam US-122. I am wanting to get a whole new outfit now. The Tascam US-122 seems a little on the cheap side, not exactly sure why, maybe it's awesome I don't know but I want a ne

  • System Freeze after Waking from Sleep

    Hi, I have seen a few other posts out there with similar issues however mine is a little different. I have been noticing a few oddities since updating to Mac OS X.5, and finally X.5.1. The first challenge I noticed was that my machine does not go to