Calling PLSQL Procedure with CLOB input parameter from JDBC

Hi..
I've got a PLSQL procedure with a CLOB object as input parameter:
function saveProject (xmldoc CLOB) RETURN varchar IS
I want to call that procedure from my JDBC Application as...
String data = "..."
CallableStatement proc = conn.prepareCall
          ("begin ? := saveProject (?); end;");
neither
proc.setCharacterStream(2, new StringReader(data, data.length());
nor
proc.setString(2, data);
will work.
The Application throws java.sql.Exception: ... PLS-00306 wrong
number or types of arguments in call 'SAVEPROJECT'
How can I use set setClob method?
The Problem is: with Oracles CLOB implementation I can't create
an Instance, and from the CallableStatement a can't get a
Locator for a CLOB-Object.
This CLOB stuff makes me really nuts!
please somebody help me.. thanks
Alex

Hi All,
You can not make it like that.
You can not make clob as input parameter.
Do you want an easy way?
This is the easy way.
sample:
function myFunction(S varchar2(40))
return integer as
begin
insert into TableAAA values(S)
--TableAAA only contains 1 column of clob type
end;
This will work the problem with this is the parameter is in
varchar2 right? so there will be limited length for it.
You can do this to call that function:
nyFunction('My String that will be input into clob field');
There's another slight difficult way, I understand that you have
installed Oracle client/server in your system, try to look at
jdbc folder and try to find demo.zip in that folder, you can
find several ways of doing thing with jdbc.
Have a nice day,
Evan

Similar Messages

  • Call a storedprocedure with CLOB input parameter gives ORA-24811 error

    Hi all,
         I am calling a storedprocedure from VB using ADO and OraOLEDB. Calling stored procedure as mention in OraOLED documentation.
         The procedure accepts a varchar and a CLOB parameter.
         While executing the store procedure its throw an error as “Error while trying to retrieve text for error ORA-24811”
         Then I executed a storeprocedure with only one CLOB out parameter. It is working fine.
         Oracle version is
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    PL/SQL Release 9.2.0.4.0 - Production
    CORE 9.2.0.3.0 Production
    TNS for Linux IA64: Version 9.2.0.4.0 - Production
    NLSRTL Version 9.2.0.4.0 - Production
         O/S: Linux.
         OLEDB version 9.0.1.0.1
         But exact code working with
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE 9.2.0.1.0 Production
    TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 – Production
    O/S window 2003
    OLEDB version 9.0.1.0.1
    Can somebody help me on this?
    Regards,
    Mani
    Sample code of stored of stored procedure and VB function pasted below.
    StoreProcedure
    ============
    create or replace procedure xmltext (EmpName varchar2,EmpDetails CLOB)
    as
    begin
    insert into emptmp values (EmpName);
    end;
    VB function
    =========
    Dim Oracon As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim param1 As New ADODB.Parameter
    Dim param2 As New ADODB.Parameter
    Dim empname As String
    Dim empdetails As String
    Set Oracon = CreateObject("ADODB.Connection")
    Oracon.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=testdb;User ID=newtest;Password= newtest;PLSQLRSet=1;SPPrmsLOB=1"
    Oracon.Open
    empname = "Mani"
    empdetails = "<EmpDet/>"
    Set cmd.ActiveConnection = Oracon
    cmd.CommandType = adCmdText
    Set param1 = cmd.CreateParameter("param1", adVarChar, adParamOutput, 10, empname)
    cmd.Parameters.Append param1
    Set param2 = cmd.CreateParameter("param2", adLongVarChar, adParamInput, 10000, empdetails)
    cmd.Parameters.Append param2
    cmd.CommandText = "{ call xmlText(?,?)}"
    cmd.Execute

    code for my procedure testblob is :
    create or replace procedure testblob(bpic blob) as
         val               blob;
         v_rdata          blob;
         v_start          BINARY_INTEGER := 1;
         v_buffer     BINARY_INTEGER := 32767;
    BEGIN
    select pic into val from my_pic where no=1 for update;
    DBMS_LOB.OPEN (val, DBMS_LOB.LOB_READWRITE);
    FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(bpic) / v_buffer)
         LOOP
         v_rdata :=DBMS_LOB.SUBSTR(bpic, v_buffer, v_start) ;
         DBMS_LOB.WRITEAPPEND(val, DBMS_LOB.GETLENGTH(v_rdata), v_rdata);
         v_start := v_start + v_buffer;
         END LOOP;
    dbms_lob.close(val);
    exception
         when others then
              raise_application_error(-20000,sqlerrm);     
    end;

  • Creating a job for a procedure with an input parameter

    Hi,
    I want to create a job for a procedure ( sp_proc ) with a input parameter.
    The input parameter is a date value.
    As per the syntax for dbms_job.submit procedure;
    dbms_job.submit (
    job IN BINARY_INTEGER,
    what IN VARCHAR2,
    next_date IN DATE,
    interval IN VARCHAR2 DEFAULT 'NULL',
    no_parse IN BOOLEAN DEFAULT FALSE);
    How should the procedure be declared in the 'what' parameter of the dbms_job.submit procedure ?
    Please guide.
    Thanks.

    Hi,
    You are wright, I have found this thread [DBMS_JOB -- how to pass parameters to the job|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:351033761220].
    Regards,

  • Db Adapter: problems by calling a procedure with type as parameter

    Hi,
    We using a db adapter in a bpel process.
    In that dapter we call a procedure with types as in and out parameter
    package.procedure(p_in IN in_t, p_rsult OUT result_t).
    When we calling the procedure, we don't call the procedure directly.
    We call that procedure in a schema who have the execute rigths for the package and the types.
    When we run the process we get the error message
    unable to convert the xsd element p_in whose user defined type is in_t
    cause: java.sql.SQLException: ora-01436 connect by loop in user data
    I am not shore if I draw the right conclusions.
    Is it rigth that bpel have a problem by using types as parameter when using two schematas? Isn't it a bug.
    For every help I was thankful.
    Thanks in advanced.
    Michael

    Hi,
    thanks for the hint. I have implemented a wrapper package and it's working well.
    Only one crux. The parameter of the called procedure are data types and not simple types.
    CREATE OR REPLACE TYPE pesa_db_return_t AS OBJECT
    (SUCCESS_MSG varchar2(255)
    ,FAULT_SQLCODE varchar2(255)
    ,FAULT_SQLMSG varchar2(255)
    Wrapper package...
    IS
    PROCEDURE prc_writeReOinDB (p_AuftragRechnungOnline IN pesa_data.pesa_tivu_reo_t
    ,p_result OUT pesa_data.pesa_db_return_t)
    IS
    BEGIN
    pkg_pesa_reo.prc_writeReOinDB (p_AuftragRechnungOnline => p_AuftragRechnungOnline
    ,p_result => p_result
    END prc_writeReOinDB;
    END pkg_pesa_wrapper;
    So I have to declare the parameter with the schema user in front of.
    Now, we have deployed thes sources on a second enviroment and get following error:
    <2008-04-22 15:01:25,749> <ERROR> <eweber.collaxa.cube.engine.dispatch> <BaseScheduledWorker::process> Failed to handle dispatch message ... exception ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.instance.CallbackDeliveryMessage"; the exception is: Type class not found.
    Cannot find class for type "org.apache.xerces.dom.ElementNSImpl". Please check that the class is located in the classpath.
    You have a hint for me what I have to do?
    Thanks in advanced,
    Michael

  • Calling Stored Procedure with CLOB parameter

    Hi,
    i have one procedure with IN parameter CLOB which is taking xml file and stored in one table column and this table column datatype is also CLOB. And this procedure called by .Net program but problem is when the file will come more than 32KB calling procedure failed. But as i know CLOB can stored up to 4GB data.
    Is that Limitation of oracle or .Net version
    please let me know the solution for that,
    Create Procedure Insert_File(P_XMLFILE IN CLOB)
    as
    begin
    insert into instances
    values(p_xmlfile);
    commit;
    end;
    regards,
    Madan

    Hi Thanks for your reply,
    Actually this procedure called by .net program and the XML file has passed in that parameter which come from some FTP(its inbound) and this files we are storing into above mentioned table.
    Error has come while calling stored procedure Through .net
    Error Details:
    Error calling stored procedure. 0 retry attemps has failed. Error: System.Exception: Error while calling stored procedure on Oracle: INSERT_FILE: System.Data.OracleClient.OracleException: ORA-01460: unimplemented or unreasonable conversion requested

  • Calling Stored Procedure with Boolean Output Parameter

    Hi all,
    I'm running into an issue (or is it a BUG) when calling a Database Stored Procedure that has an output parameter of the boolean type.
    procedure proc(p_text in varchar2, p_result out boolean)
    is
    .....I use the following 'standard' code (developer guide 36-19 36-20) to invoke this procedure from my application module.
            try {
                // 1. Define the PL/SQL block for the statement to invoke
                String stmt = "begin proc(?,?); end;";
                // 2. Create the CallableStatement for the PL/SQL block
                st = getDBTransaction().createCallableStatement(stmt, 0);
                // 3. Register the positions and types of the OUT parameters
                st.registerOutParameter(2, Types.BOOLEAN);
                // 4. Set the bind values of the IN parameters
                st.setObject(1, "Some text");
                // 5. Execute the statement
                st.executeUpdate();
                ..............................As soon as 'st.registerOutParameter(2, Types.BOOLEAN);' is invoked I run into a SQLexception. "Invalid ColumnType: 16". Obviously 16 refers to Types.BOOLEAN.
    [edit by Luc]
    SOLUTION / WORKAROUND
    To answer my own question.
    It looks like BOOLEAN output parameters are not supported. I just Read "Appendix D Troubleshooting" of the Oracle® Database JDBC Developer's Guide and Reference 10g Release 2 (10.2).
    I found that JDBC drivers do not support the passing of BOOLEAN parameters to PL/SQL stored procedures. If a PL/SQL procedure contains BOOLEAN values, you can work around the restriction by wrapping the PL/SQL procedure with a second PL/SQL procedure that accepts the argument as an INT and passes it to the first stored procedure. When the second procedure is called, the server performs the conversion from INT to BOOLEAN.
    I'm not very happy with this but I guess I've no choice.
    Regards Luc
    Edited by: lucbors on Nov 30, 2010 10:37 AM

    fyi
    Related to the solution/workaround posted by Luc.
    see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
    at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
    regards
    Jan Vervecken

  • Calling Stored Procedure with OraClob as parameter IN

    I am using Visual C++ and using oo4o the ole way
    I am try to call stored procedure that have Clob as parameter in
    it seems the the OraParameters Add method don't have the ability since it can only receive variantt.
    How do I do it
    Thanks
    Yoav

    fyi
    Related to the solution/workaround posted by Luc.
    see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
    at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
    regards
    Jan Vervecken

  • How to call a procedure with SYS_REFCURSOR OUT parameter

    Hi,
    Using Oracle 11g R2.
    I'd like to know if it is possible to display the results of a SYS_REFCURSOR in a query. For example, if I had the following stored procedure
    create or replace procedure testprocedure (result OUT sys_refcursor)
    as
    begin
       open result for
          select 1 from dual
          union all
          select 2 from dual;
    end;
    I'd like to call this procedure similar to the way a query is called and executed. Like this
    select * from testprocedure
    I've seen plenty of examples on the web which show how it is possible to loop through results of a sys_refcursor inside of an anonymous block and display the results using dbms_output.putline, but this isn't the method I am looking for.

    I'd like to know if it is possible to display the results of a SYS_REFCURSOR in a query. For example, if I had the following stored procedure
    No - you can only use schema object types (SQL) in SQL queries and only then if you call a function.
    The function can return a SQL collection type or it can be a PIPELINED function whose return value is a SQL collection type. Either way your query will use the TABLE function and be of the form:
    select * from TABLE(testfunction);
    This is sample code for a PIPELINED function based on the SCOTT.EMP table. The function takes a department number parameter and returns the EMP rows for that department:
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
    select * from table(get_emp(20))

  • Call function from data base with clob input parameter.

    Hello,
    In this project I use Jdev 11g.
    I call function from database.
    create or replace function get_fa_list (
    p_fa_id_list in clob
    return sys_refcursor
    is
    vCursor sys_refcursor;
    begin
    put_msg ('begin');
    if p_fa_id_list is null then
    put_msg ('CLOB is null!');
    else
    put_msg ('size CLOB: ' || dbms_lob.getlength (p_fa_id_list));
    end if;
    put_msg ('Save');
    open vCursor for
    select rownum as id, s.*
    from (
    select f.latitude, f.longitude, count (distinct f.res_id) as res_count, count (*) as fa_count, 16711680 as color, res_concat_distinct (f.res_id) as station_list
    from mv_frequency_assignment f, table (SplitClob (p_fa_id_list, ',')) l
    where f.ext_system = 'BI' and
    f.ext_sys_id = l.column_value
    group by f.latitude, f.longitude
    ) s;
    put_msg ('Open and End');
    return vCursor;
    end get_fa_list;
    I use TopLink in ejb.
    i use follow code for call function and get result.
    public List<TmpResPoints> findAllPointsBI(String p_id){
    UnitOfWork uow = getSessionFactory().acquireUnitOfWork();
    uow.beginEarlyTransaction();
    StoredFunctionCall call = new StoredFunctionCall();
    call.setProcedureName("get_fa_list");
    call.useUnnamedCursorOutputAsResultSet();
    ClobDomain c = new ClobDomain(p_id);
    //System.out.println(c.toString());
    call.addNamedArgumentValue("p_fa_id_list", c);
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(TmpResPoints.class);
    query.setCall(call);
    List<TmpResPoints> result = (List<TmpResPoints>)uow.executeQuery(query);
    uow.commit();
    uow.release();
    return result;
    But size parameter "p_fa_id_list" is 0. (geting from temp table in Data base). this code in function >>
    if p_fa_id_list is null then
    put_msg ('CLOB is null!');
    else
    put_msg ('size CLOB: ' || dbms_lob.getlength (p_fa_id_list));
    end if;)
    How I can call this function from dataBase and get result?
    thx,
    Demka.

    What is the SQL generated?
    The argument should just be the Clob value (a String) not the domain object.
    Also try addNamedArgument, and then pass the named argument to the query.
    James : http://www.eclipselink.org

  • Stored procedure with custom type failed from jdbc

    DECLARE X Abp_Online_Dataselection.BULK_SCHEME_TAB; BEGIN Abp_Online_Dataselection.ABP_ONLINE_SCHEMESELECTION('BSWD','IN','NEW',X); FOR R IN X.FIRST .. X.LAST LOOP DBMS_OUTPUT.PUT_LINE(X(R).SCHEME_NAME); DBMS_OUTPUT.PUT_LINE(X(R).ISSUE); DBMS_OUTPUT.PUT_LINE(X(R).CURRENCY); DBMS_OUTPUT.PUT_LINE(X(R).PRICE); DBMS_OUTPUT.PUT_LINE(X(R).GIFT); END LOOP; END;
    Here Abp_Online_Dataselection.ABP_ONLINE_SCHEMESELECTION is the stored procedure which I can run
    in SQL client.
    How can I access the result returned by this.
    What I have tried is this
    Connection conn = myservice.getPooledTestConnection();                CallableStatement cstmt =  conn.prepareCall("{call Abp_Online_Dataselection.ABP_ONLINE_SCHEMESELECTION(?,?,?,?)}");         java.sql.Array recarray;         cstmt.setString(1, "BSWD");         cstmt.setString(2, "IN");         cstmt.setString(3, "NEW");                cstmt.registerOutParameter(4, java.sql.Types.OBJECT); // What is the right type?         if (cstmt.execute()) { }
    This gives invalid column type exception.

    Normally it requires driver specific code.
    If it was me I would wrap it in another proc and use a cursor (or whatever it takes) to traverse the result so it returns a normal result set to java.

  • JDBC-Adapter-Receiver Calling Stored Procedure with Input-Typ Record

    Hallo,
    I´ m trying calling a stored-procedure with two input-parameter; one of typ record (oracle) and one of type tabel of records. Is this possible (I think there are only types like string, integer etc. possible)? When not is there another possibility to work with that type?
    Thanks in advance,
    Frank

    Hi Frank,
    I think stored procedures will not take Array of Records as a Input. If you want to make a loop funtionality etc then JDBC adapter will work accordingly. You need to just call the stored procedure from the JDBC adapter. It will work for the array of records(multiple occurences).
    Receiver JDBC Procedures.
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Alternative option is you can make use of Java Proxy and from there you can call stored procedure ..I think it is possible.. not tried.
    Hope this helps
    Regards,
    Moorthy

  • In SQLScript, how to use EXEC to call another procedure with parameters in procedure?

    Hi experts,
    In SQLScript, How to use EXEC to call another procedure with input and output parameters in procedure?thanks very much

    Hi Sagar,
    thank you! I generate another procedure with an input parameter and an output parameter in a procedure. Then i need to call the generated procedure using EXEC. Here is my code:
    create procedure ftest1(out sum_num bigint)
    as
    begin
    declare fa_output bigint;
    declare v_sql_drop varchar(200);
    declare v_sql varchar(500);
    declare cursor c_cursor1 for select num from TABLE1;
    --v_sql_drop := 'drop procedure fe';
    --exec v_sql_drop;
    v_sql := 'create procedure fe(in i_num bigint,out o_num bigint) as begin';
    v_sql := :v_sql || ' o_num := :i_num * 2 + :i_num * :i_num;';
    v_sql := :v_sql || ' end';
    exec v_sql;
    open c_cursor1;
    for c_item as c_cursor1 do
    exec 'call fe(c_item.num,o_num=>fa_output)';
    if sum_num is null then
    sum_num := fa_output;
    else
    sum_num := :sum_num + fa_output;
    end if;
    end for;
    close c_cursor1;
    end;
    The underline code is using exec to call the generated procedure. But this method cannot work. Any suggestion? thanks again!

  • 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

  • How to call a oracle procedure with in/out parameter frm unix shell script?

    Hi,
    I need to call an oracle stored procedure from unix script. The procedure has 1 input parameter and 2 output parameter. Please send me the syntax for the same. Based on the output values of procedure, I have to execute some more commands in unix script.
    Thanks and regards
    A

    An example :
    TEST@db102 SQL> select ename, job from emp
      2  where empno = 7902;
    ENAME      JOB
    FORD       ANALYST
    TEST@db102 SQL> create or replace procedure show_emp (
      2     v_empno in      number,
      3     v_ename out     varchar2,
      4     v_job   out     varchar2 )
      5  is
      6  begin
      7     select ename, job into v_ename, v_job
      8     from emp
      9     where empno = v_empno;
    10  end;
    TEST@db102 SQL> /
    Procedure created.
    TEST@db102 SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    [ora102 work db102]$ IN=7902
    [ora102 work db102]$ set `sqlplus -s test/test@db102 << !
    var out1 varchar2(30);
    var out2 varchar2(30);
    set pages 0
    set feed off
    exec show_emp($IN,:out1,:out2);
    print
    exit
    `[ora102 work db102]$ echo $1 $2
    FORD ANALYST
    [ora102 work db102]$                           

  • Call stored procedure with OUT parameter

    Hello,
    I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
    The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
    Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
    Has someone been able to call a stored procedure with an OUT parameter?
    Regards,
    Nico

    Object is Foundation, Execute Script
    This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.sql.*;
    PreparedStatement stmt = null;
    Connection conn = null;
    ResultSet rs = null;
    try {
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
    conn = ds.getConnection();
    stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
    stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
    rs = stmt.executeQuery();
    rs.next();
    patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
    } finally {
    try {
    rs.close();
    } catch (Exception rse) {}
    try {
    stmt.close();
    } catch (Exception sse) {}
    try {
    conn.close();
    } catch (Exception cse) {}

Maybe you are looking for