Stored procedure hanging

Okay, I've got all the code for the stored procedure working. The procedure looks like this
PROCEDURE scp_wide_aftmkt_limit_sum
(p_temp_date IN date,
p_merchant_id IN number,
p_exch_contract_pub_ids IN
exch_contract_pub_id_array,
p_merchant_exchanges IN OUT
limit_count_status_array)
The two arrays look like this -
exch_contract_pub_id_array VARRAY(20) OF NUMBER(10)
limit_count_status_array VARRAY(20) OF limit_count_status_rec
The struct above looks like this -
limit_count_status_rec contains
summed_amt IS NUMBER(38)
trading_limit IS NUMBER(38)
status_text IS VARCHAR2(100)
The code I'm using to setup the procedure call (the jdbcConnection was already setup) -
// Create the array descriptor
ArrayDescriptor ad =
ArrayDescriptor.createDescriptor("EXCH_CONTRACT_PUB_ID_ARRAY", jdbcConn);
// Create an array using the ids
ARRAY array = new ARRAY(ad, jdbcConn, ids);
//put in stored procedure call here
s = jdbcConn.prepareCall("BEGIN scp_wide_aftmkt_limit_sum(?,?,?,?); END;");
s.setDate(1, new Date(System.currentTimeMillis()));
s.setDouble(2, merchantId.doubleValue());
s.setArray(3, array);
s.registerOutParameter(4, Types.ARRAY, "LIMIT_COUNT_STATUS_ARRAY");
// Call the proc
s.executeUpdate();
// Get the stuff out of the array
Array outArray = s.getArray(4);
ResultSet sumRS = outArray.getResultSet();
The code is hanging on the s.executeUpdate() line forever. I can't figure out if I'm setting up the IN/OUT parameter incorrectly, or if it has to do with the thin drivers I'm using (even though the FAQ says it should work with the thin drivers), or anything else. Any help would be great and if more info is needed, post and I'll get back ASAP. Thanks
Brian Pontarelli
Java Programmer
XOR Inc.
[email protected]
303-448-4865
null

More specifically, use NOT EXISTS instead of NOT IN.
Craig...

Similar Messages

  • Executing batch file from Java stored procedure hang

    Dears,
    I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
    public static String runFile(String drive)
    String result = "";
    String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
    try {
    File directory = new File(drive + ":");
    File file = File.createTempFile("bb1", ".bat", directory);
    file.deleteOnExit();
    FileWriter fw = new java.io.FileWriter(file);
    fw.write(content);
    fw.close();
    // The next line is the command causing the problem
    Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = input.readLine()) != null)
    result += line;
    input.close();
    file.delete();
    result = result.substring( result.lastIndexOf( ' ' )).trim();
    } catch (Exception e) {
    e.printStackTrace();
    result = e.getClass().getName() + " : " + e.getMessage();
    return result;
    The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
    I gave the SYSTEM schema the required privilege to execute the code.
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    GRANT JAVAUSERPRIV TO SYSTEM;
    I have used the following to load the class in Oracle 9ir2 DB:
    loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
    CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
    I have seen similar problems on other forums, but no solution posted
    [http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
    I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
    Can anyne help?

    Dear Peter,
    You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
    I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
    The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
    The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
    where content of bb1.bat as follows:
    echo off
    vol C: | find /i "Serial Number is"
    The above batch file just get the serial number of hard drive assigned when windows formatted HD.
    Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    Never returns
    Thanks for tracing teh issue to that details ;) hope you coul help.

  • Arrays as out param on stored procedure causes hang

    Hi,
    I would like to be able to use an ARRAY to pass data back from a java stored procedure. Calling the stored procedure using jdbc, the procedure hangs. If I change the out param to a VARCHAR, the procedure works fine (although, of course, the size of the data returned is limited).
    I defined a varray type:
    CREATE TYPE str_array AS VARRAY(100) OF VARCHAR2(255);
    I defined the stored procedure:
    CREATE OR REPLACE PROCEDURE ob_snapshot(symbol VARCHAR2, start_time DATE, end_time DATE, interval NUMBER, depth NUMBER, output_result IN OUT STR_ARRAY)
    AS LANGUAGE JAVA
    NAME 'OBSnapshot.snapshot(java.lang.String, java.sql.Timestamp, java.sql.Timestamp, int, int, oracle.sql.ARRAY[])';
    The execute on the CallableStatement never finshes. Any ideas ?
    Thanks for the help,
    Chris Opler
    null

    I recommend you declare your iterator as follows :
    public class yourApp {
    #sql public static iterator Temp1 (...);
    null

  • Exports hangs in stored procedures

    hi i am running oracle 8.1.7 on solaris 8 when i am doing the export the export goes fine but when its reaching exporting stored procedures last after the integrity constraints the export is hanging and giving error
    last terminated with unsuccessfully,what may be the reason only for the stored procdures failing in export.How to fix this
    wiht regards
    ramys

    hi there is
    no errors comming from the export logs.The export hangs and for long time and i have to cancel the export session
    and giving export terminated unsuccesfully,how to fix it
    with regards
    ramya

  • Debugger gets hanged on call to stored procedure

    We are using Forms 6i Patch 12.
    The Forms Debugger is getting hanged whenever it encounters a line making a call to stored procedure.
    In earlier versions, we debugger used to "Step Over" instead of allowing a "Step into" on such statements.
    Any Solutions will be appreciated!

    We are working like that.
    Even on new stored procedures, the debugger is getting hanged whether we do any stepping around that line or not.
    There appears to be something wrong with debugger or its settings. It is ok for us if it does not allow "Step Into" in a stored procedure as we can put it as local program unit if any step into is required.
    However, for already tested stored procedures, we can have a step over.
    We do not want to copy all the stored procedures being used in a form as local program units just because the debugger gets hanged whenever it sees a call to stored procedure irrespective of a "Step over", "Step Into" or "Go".
    The problem is how to prevent the debugger from getting hanged.
    Regards,
    Sanjiv

  • Stored Procedure Does Not Run Properly When Called From Portlet

    We have a simple Java portlet that calls a PL/SQL stored procedure which we wrote. The stored procedure sends a large number of emails to users in our corporation using the "utl_smtp" package. The stored procedure returns a count of the emails back to the Java portlet when it's finished. This number is displayed in the portlet.
    Our problem:
    The stored procedure functions as expected when run from a PL/SQL block in SQL*Plus, and the Java portlet calls the procedure properly when sending out a smaller number of emails (Less than 200 usually). When we get into a higher number of emails the procedure hangs when called from the portlet, but it STILL functions properly from SQL*Plus. It does not return the number of emails sent
    and the Java portlet is unable to return a SQLException. Also, we have noticed that emails are sent at a much slower pace from the stored procedure when it's called from the portlet.

    Any Ideas?

  • How to simulate a dml error in order to test try-catch code block inside a stored procedure

    Hi,
    What would be the easiest way to simulate a dml error in order to test a try catch block.
    I would like to do it with a simple command from outside the stored procedure if possible.
    I tried dropping the table that was updated but it hangs
    Thanks,
    Dani

    Dropping the table that is the target of the procedure will give you an unpleasant surprise: the CATCH block will not fire. To wit, errors like missing tables can only be caught in outer scopes, but not in the procedure where the error occurs.
    But you would add a fake constraint to a table which causes the update to fail. You need to do this in advance, not while running the procedure.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Problem in Stored Procedure with DBMS_OUTPUT statement

    Hi All,
    I am facing a problem in the stored procedure.
    In the stored procedure I am picking records from the table and displaying them in the screen using dbms_output.put_line statement. This works fine if my query fetches few records but in case of many records(84000 records) then the oracle application gets hanged.

    1) How (if at all) does this relate to SQLJ/JDBC? I assume there is some relationship because of the forum you're posting to, so I'm trying to understand whether that relationship is germane to the problem you are having.
    2) Why are you writing 86,000 rows of output to the dbms_output buffer? Why wouldn't your stored procedure return a REF CURSOR to your Java application and just have the Java application iterate through those rows?
    Justin

  • Calling Stored procedure in Oracle 11g from Oracle forms developer 6i

    We have Oracle 11g (11.1.0.7.0 ) database (64 bit) installed on Windows Server 2008.
    In this database, we have stored procedure ABC(arg1) which is accesing a table in another instance through DB LINK. If we EXECUTE this procedure from SQL/TOAD. It runs successfully and generates the desired output.
    If we write the contents of the stored procedure in the PROGRAM UNIT / ANY TRIGGER in FORM 6i then also, It runs successfully and generates the desired output.
    It is also mentioned, that if we try to use any table in the same instance (and not through DBLINK) then it works fine.
    However, if we try to call this stored procedure (which is  accesing a table in another instance through DB LINK) from  ORACLE FORMS  6i  in WHEN-BUTTON-PRESSED trigger then the FORM BUILDER gets hanged while compiling the form developed in FORMS 6i.
    Please provide a solution to this problem.
    THANKS IN ADVANCE.
    Hemant Singh.
    Asstt. Manager(IT)
    Software development team.

    Forms 6i was never meant to run against a 11g database, this was not tested and is also not supported.Well, that is not completely true. Developer 6i is supported against a 11g database, but only for Oracle Apps R11. That means that for most other customers (not Apps) Forms 6i will work against an 11g database. However, only Apps R11 is supported, and patches are only created specifically for Apps. We are also running Forms 6i against an 11g database without (well, minor) problems.
    In this case, you need to find a solution. You can try to put the stored procedure in a package. The package body, with the reference to the remote table, will be hidden from Forms this way.

  • Hashset Object Setting in Stored procedure

    I have a store Procedure:
    CREATE PROCEDURE TESTING_SET(TEST_SET SET(CHAR(100) NOT NULL))
    RETURNING CHAR(100);
    DEFINE element CHAR(100);
    FOREACH SELECT * INTO element FROM TABLE(TEST_SET)
    RETURN element WITH RESUME;
    END FOREACH;
    END PROCEDURE;
    I am trying to call a stored procedure using CallableStetement. The stored procedure accepts a SET object. So I am setting the Hasset as CallableStatement.setObject(HashSet);
    But when the CallableStatement.execte() is called I am getting the following error:
    java.sql.SQLException: Routine (testing_set) can not be resolved.
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3631)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3963)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2693)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2609)
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:1828)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2521)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2461)
    at com.informix.jdbc.IfxResultSet.b(IfxResultSet.java:393)
    at com.informix.jdbc.IfxStatement.a(IfxStatement.java:1326)
    at com.informix.jdbc.IfxPreparedStatement.d(IfxPreparedStatement.java:449)
    at com.informix.jdbc.IfxCallableStatement.execute(IfxCallableStatement.java:331)
    at com.west.wic.test.HashSetTest.main(HashSetTest.java:40)
    Caused by: java.sql.SQLException
    at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3968)
    ... 10 more
    error message:Routine (testing_set) can not be resolved.
    error code:-674
    Please help me in this regard.

    >
    I wasn't directly replying to you
    >
    Well maybe that wasn't your intention but that is what this line in the reply means:
    >
    Posted: May 3, 2013 12:19 PM in response to: rp0428
    >
    That means you are responding to 'rp0428'; that's me. So when you say this
    >
    But first make sure that the database user you're using
    >
    And because your comments are 'in response to: rp0428' the word "you're" is generally going to be interpreted to mean 'rp0428' unless you indicate otherwise.
    If you had responded to OP that word "you're" would mean you are telling OP to
    >
    first make sure that the database user you're using
    >
    It isn't a question of 'right'; it is a question of how to address your remarks to the proper person so that that person KNOWS the remarks are meant for them.
    Here's an easy way for you to remember who to reply to: it is the same person you would LOOK at if you were in the same room with them.
    You would be looking at me while you were listening to my comments. Then you would turn and look at OP when you made yours. In the forum you accomplish that by using the 'reply' link on one of OP's comments.
    If, for some reason, you did want to make comments to both of us in your one reply then pick one to reply to, even me, and then preface your comment to OP like this:
    >
    -- comment here for rp0428 - but you didn't make any
    OP: first make sure that the database user you're using . . .
    >
    See how that 'OP:' prefix makes it clear that, even though your comments are 'in response to: rp0428' that particular comment is meant for OP?
    It might be aarkward at first but once you try it a few times you'll get the hang of it. ;)

  • Calling stored procedure from DAC

    Anyone has instructions on calling stored procedures from DAC. If I had a stored procedure called gary.refresh, where would I put that in the DAC. How do I specify the database that my stored procedure is in.. There doesn't seem to be any examples of this in the documentation for DAC administration
    Edited by: user8092687 on Jun 6, 2011 7:51 AM

    You have 3 options.
    Option 1:
    Create an SQL file that runs the stored proc. For instance, if
    your stored proc is called "aggregate_proc" you would create a
    file called aggregate_proc.sql that has the syntax to run the
    stored proc. Put the file in the CustomSQLs directory that hangs
    off the DAC main directory. Then, in the DAC, create a new task
    (Execution Type = SQL File). The command for Incremental Load
    would be aggregate_proc.sql.
    Option 2:
    Create an Informatica mapping (and corresponding workflow) that
    runs the stored proc. Then create a DAC task (Execution type Informatica) that runs the workflow.
    Option 3 :
    Directly mention Schema.procedure name in the DAC task
    Hope this helps,
    - Amith

  • Stored Procedure Concurrency Problem 10g

    dear all,
    Please any one could help on this my problem is appreciated.......
    i'm generating ticket numbers using stored procedure as below .
    i need to know followings .....(i'm using oracle 10g)
    1 .Does oracle stored procedure handle concurrency by default or does db manage concurrency when we using sps or do we have handle concurrency inside a stored procedure?
    2.when i generating ticket no using this stored procedure is there any concurrency issue when 100 clients are access it concurrently???
    3. Is there issue or bug in my java code??????????
    4.I have already used select for update statement but when i used that in db rowlocks are hanging and db become stuck .........
    SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE = xscheme for update;
    5. and in my where clause i pass branch and scheme eg:SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE =
    xscheme;
    when i run this sp oracle return the error 'more than one row return by query'
    but when run query seperately it will return exactly one row for same brach code and scheme code no duplicates.
    why this happen and it also happen to update statement it will ignore branch code and update for all schemes
    UPDATE SERIAL_TAB SET serial_no=newSerial WHERE BR_CODE=xbranch AND SCH_CODE = xscheme;
    what should i do ? sorry for my long question since i'm in deep trouble.....................
    could any one can help please................................
    in my java code i use transaction and setAutoCommit(false) when calling this sp
    public String getTicketNo(String br,String sch){
    //getconnection
    //setAutoCommit(False);
    //call sp get return value ;
    //commit;
    //if error rollback transaction
    create or replace PROCEDURE sp_generate_ticket (
    xbranch in varchar,
    xscheme in varchar ,
    xresult OUT VARCHAR
    ) AS
    BEGIN
    newSerial:=0;
    SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE = xscheme;
    newSerial:=newSerial+1;
    UPDATE SERIAL_TAB SET serial_no=newSerial WHERE BR_CODE=xbranch AND SCH_CODE = xscheme;
    --- do other operations -------------------------------------------------------------------------------------
    END;
    Best Regards,
    Pradeep.
    Edited by: user8958520 on Jan 1, 2012 10:02 PM

    user8958520 wrote:
    i need to know followings .....(i'm using oracle 10g)
    1 .Does oracle stored procedure handle concurrency by default or does db manage concurrency when we using sps or do we have handle concurrency inside a stored procedure?Oracle is a multi-user and multi-process system. It supports concurrency. It also requires the developer to design and write "+thread safe+" code. Its concurrency cannot address and fix design flaws in application code.
    2.when i generating ticket no using this stored procedure is there any concurrency issue when 100 clients are access it concurrently???That depends entirely on WHAT that procedure code does. And whether that code is thread safe.
    4.I have already used select for update statement but when i used that in db rowlocks are hanging and db become stuck .........
    SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE = xscheme for update;Horrible and utterly flawed approach. This forces serialisation. This means if that procedure is call by a 100 clients, only a SINGLE client can be serviced at a time. ALL OTHERS need to queue and WAIT.
    Serialisation kills database performance.
    What you have is a serious design flaw. Not an Oracle issue. And there is no magic solution to make this flawed approach work in a performant and scalable manner. This flaw introduces artificial contention. This flaw enforces serialisation. This flaw means that your application code WILL step on its own toes time and time again.
    The proper solution is to fix this design flaw - and not use poorly conceived procedures such as sp_generate_ticket that violates fundamental concurrency principles.

  • How to retrive data through stored procedure in mysql from remote machine?

    Hello everybody,
    I am having problem in accessing data of mysql through stored procedure. It works fine if I use "jdbc:mysql://localhost:3306/[database name]" instead of "jdbc:mysql://[IP address]:3306/[database name]". The connection is fine for both, but when stored procedure is called the system stops at "stmt.execute();" line in java file while debuging. In case of localhost there is no any problem. The code for connecting procedure is:
    stmt = dbConn.prepareCall("{? = call testing()}"); stmt.registerOutParameter(1, Types.VARCHAR); stmt.execute();
    I have to connect java application running in Windows to the mysql database running in remote machine(RHEL 5).
    I am using "mysql-connector-java-5.1.5-bin.jar", jdk 1.5.0 and remote database Mysql version : 5.0.22.
    There is no exception and application hangs at stmt.execute();
    Can anybody help me with this problem?
    Thank you.

    I got it. its about connection...

  • Invoking "java myClass" using Runtime.Exec from a Java Stored Procedure

    Hi All,
    This is regarding the use of Runtime.getRunTime().exec, from a java programme (a Java Stored Procedure), to invoke another Java Class in command prompt.
    I have read many threads here where people have been successuful in invoking OS calls, like any .exe file or batch file etc, from withing Java using the Runtime object.
    Even i have tried a sample java programme from where i can invoke notepad.exe.
    But i want to invoke another command prompt and run a java class, basically in this format:
    {"cmd.exe","java myClass"}.
    When i run my java programme (in command prompt), it doesnt invoke another command prompt...it just stays hanging.
    When i run the java programme from my IDE, VisualCafe, it does open up a command prompt, but doesnt get the second command "java myCLass".
    Infact on the title of the command prompt (the blue frame), shows the path of the java.exe of the Visual Cafe.
    and anyway, it doesnt run my java class, that i have specified inside the programme.
    Even if i try to run a JAR file, it still doesnt do anything.
    (the JAR file other wise runs fine when i manually invoke it from the command prompt).
    Well, my question is, actually i want to do this from a Java Stored Procedure inside oracle 8.1.7.
    My feeling is, since the Java Stored Procedure wont be running from the command prompt (i will be actually invoking it through a Oracle trigger), it may be able to invoke the command prompt and run the java class i want. and that java class has to run with the SUn's Java, not Oracle JAva.
    Does any one have any idea about it?
    Has anyone ever invoked a java class or JAR file in command prompt from another Java Programme?
    YOur help will be highly appreciated.
    (P:S- Right now, my database is being upgraded, so i havent actually been able to create a Java Stored procedure and test it. But i have tested from a normal java programme running in command prompt and also from Visual Cafe).
    Thanks in advance.
    -- Subhasree.

    Hello Hari,
    Thanks for your quick reply.
    Can you please elaborate a little more on exactly how you did? may be just copy an dpaste taht part of teh code here?
    Thanks a lot in advance.
    --Subhasree                                                                                                                                                                                                                                                                                                                                                                                                           

  • Query in Stored Procedure accessing another schema

    Hi - this is going to sound kind of strange and even i can't come up with an explanation. My JDK 1.1.7 applet uses a type 4 JDBC thin driver (i think v 8.04.06) to access an Oracle 7.3.4 database. We also have a link with full grants and synonymns to another Oracle schema in an Oracle 8 database. Has never been a problem - we can access anything we need to through queries or stored procedures from either of these databases.
    So, i have a new stored procedure that needs to be called through JDBC that queries a table in the Oracle 8 database. For some reason, whenever i execute this stored procedure from java it hangs on this query and the instance needs to be restarted. If i execute that same stored procedure from SQL Plus, it runs fine.
    I tried a little test. I put a straight query in my java code that goes directly to that table (no stored procedure involved). It runs great through java!
    is this weird or what? my dbas have checked out all privelages and it seems that i have access to everything i could possibly need.
    If anyone has any suggestions i would love to hear them.
    thanks for your help...
    Lori - [email protected]
    null

    You can only access an object in another user's schema if you either:
    (a) Specify the 'other' schema name explicitly: SCHEMA.OBJECT
    (b) A synonymn has been created to access the object: CREATE SYNONYM OBJECT FOR SCHEMA.OBJECT.
    The user requiring the synonym should create it, or the user owning the object can create a PUBLIC synonym, if they have the authority.
    To check my hypothesis, try typing 'DESCRIBE procedure_name' from SQL*Plus as both users.

Maybe you are looking for