Stored procedure in a transaction problem

hello to everybody
I have an application under weblogic8.1 sp3.
I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
ORA-02089: COMMIT is not allowed in a subordinate session
Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...

giorgio giustiniani wrote:
hello to everybody
I have an application under weblogic8.1 sp3.
I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
ORA-02089: COMMIT is not allowed in a subordinate session
Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...It sounds like you have transactional syntax embedded in your
procedure. You can't do that and still include it in an XA
transaction.
Joe

Similar Messages

  • Problem: PL/SQL + Stored Procedure + Sequence + Trigger + Transaction + Violation Key

    I have a violation key when i insert some datas from a stored procedure. Why ???
    This is my script :
    1) The script of the table :
    CREATE TABLE OLLMULTI (
         IDO int NOT NULL ,
         IDL int NOT NULL ,
         T1 varchar2 (2) NOT NULL ,
         IDR int NOT NULL ,
         Constraint pk_outilsllmulti PRIMARY KEY (IDO, IDL, T1) ,
         Constraint u_outilsllmulti unique (IDR) );
    2) Now, i want to manage automatic increment field on IDR :
    I create a sequence :
    create sequence OLLMULTI_sequence increment by 1 start with 1;
    I create the trigger :
    create or replace trigger OLLMULTI_trigger
    before insert on OLLMULTI
    for each row when (new.IDR is null)
    begin
    select OLLMULTI_sequence.nextval into :new.IDR from dual;
    end;
    3) Now i create my store procedure and, in my procedure i want to insert 6 rows :
    Procedure Insert_OLLMULTI( i_IDO in OLLMULTI.IDO%type)
    is
    pragma AUTONOMOUS_TRANSACTION;
    BEGIN
    INSERT INTO OLLMULTI (IDO,IDL,T1)
    VALUES (i_IDO,2,'GJ');
    INSERT INTO OLLMULTI (IDO,IDL,T1)
    VALUES (i_IDO,5,'ND');
    INSERT INTO OLLMULTI (IDO,IDL,T1)
    VALUES (i_IDO,12,'AC');
    INSERT INTO OLLMULTI (IDO,IDL,T1)
    VALUES (i_IDO,120,'AH');
    INSERT INTO OLLMULTI (IDO,IDL,T1)
    VALUES (i_IDO,10,'ZG');
    INSERT INTO OLLMULTI (IDO,IDL,T1)
    VALUES (i_IDO,5,'RB');
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    rollback;
    raise;
    END;
    END;
    4) The problem :
    The violation key on the constrainst u_outilsllmulti appears sometimes on a randome insert. Never the same !
    Why ? I think that the sequence is the problem... Or is the problem is the "pragma AUTONOMOUS_TRANSACTION" command ?
    Anyone can help me ?

    Two ideas:
    - Is it possible that there are already records in the table that were
    created without using the sequence? A sequence initially starts at 1,
    if you already got data you first have to increment it.
    - May it be that some inserts happen without your procedure? The trigger
    allows to create IDs without using the sequence. Correct, there are already records in my table !!
    Thanks. That's right.

  • I want to ecute multi stored procedure in one transaction..

    In one transaction, can I excute multi stored procedure?
    if sp2 fire exception then sp1 should be rollbacked?
    OracleConnection conn = null;
    OracleTransaction tran = null;
    OracleCommand cmd = null;
    try
    conn = new OracleConnection(ConnectionString);
    cmd = new OracleCommand();
    conn.Open();
    tran = conn.BeginTransaction();
    //sp 1
    cmd.CommandText = "sp_Insert";
    cmd.CommandType=CommandType.StoredProcedure;
    cmd.Parameters.Add(new OracleParameter("id",DbType.Varchar2,"test1"));
    int retval = cmd.ExecuteNonQuery();
    cmd.Parameters.Clear();
    // sp 2
    cmd.CommandText = "sp_update";
    cmd.CommandType=CommandType.StoredProcedure;
    cmd.Parameters.Add(new OracleParameter("id",DbType.Varchar2,"test2"));
    retval = cmd.ExecuteNonQuery();
    tran.Commit();
    catch (Exception ex)
    tran.Rollback();
    }

    CREATE PROCEDURE [dbo].[model_pro]
    @mdid as int=0,
    @mkid as int = 0,--for maker table PK, FK in this table And I dont want to display in gridview
    @mkcd as char(5)='',--for maker table which I want to display in gridview
    @mdcd as char(5)='',
    @desp as char(15)='',
    @status as varchar(50)=''
    )AS
    BEGIN
    SET NOCOUNT ON;
    if(@status = 'Display')
    begin
    --Select * from model--THESE FIELDS I WANT TO DISPLAY IN GRIDVIEW
    select md.mdid,md.mdcd,md.desp,mk.mkcd
    from model md left join maker mk
    on md.mkid=mk.mkid
    end
    else if(@status = 'Add')
    begin
    --Insert into maker(mkcd) values (@mkcd)
    --Insert into model(maker.mkcd,mdcd,desp) values (@mkcd,@mdcd,@desp)
    if not exists(select md.mdid,md.mdcd,md.desp,mk.mkcd
    from model md left join maker mk
    on md.mkid=mk.mkid
    where md.mdid=@mdid and
     --md.mdcd=@mdcd or
     mk.mkcd=@mkcd -- or  --md.desp=@desp
    begin 
    insert into model(mdcd,desp,mkid)
    values(@mdcd,@desp, SCOPE_IDENTITY());
    --insert into maker(mkcd)
    --values(@mkcd);
    end
    else
    RAISERROR('make model already exists',16,1);
    end
    else if(@status = 'Update')
    begin
    Update maker set mkcd=@mkcd where mkid=@mkid
    Update model set mdcd=@mdcd, desp=@desp 
    where mdid=@mdid
    end
    else if(@status = 'Delete')
    begin
    Delete from model where mdid=@mdid
    end
    END

  • Stored procedure output parameter cast problem - there was a mistake in the

    Hi
    I call to an oracle stored procedure from java and when i get the output parameter i get a classCastException.
    The output parameter is for example of typeA
    typeA is a sql object composed by a parameter of typeB and a parameter of typeC
    typeC is a sql table of typeD objects
    and typeD, typeB are objects composed by numbers, varchar2, date.....
    I know that i have all the java to sql mappings correctly done because when my typeA is an input parameter of a procedure, it works correctly.
    But when i have it as an output parameter i can�t solve the classCastException.
    This is more or less my java code to call to the procedure:
    dbConn=DriverManager.getConnection(dnsName,dnsUser,dnsPwd);
    Map map = dbConn.getTypeMap();          
    map.put("TYPEA", Class.forName("tiposOracle.inv.Inv"));               
    map.put("TYPEB", Class.forName("tiposOracle.inv.Inv_cab"));               
    map.put("TYPED", Class.forName("tiposOracle.inv.Inv_lin"));
    CallableStatement cstmt = dbConn.prepareCall("{call GENERAL.OBTENER_MENSAJE (?,?)}");
    cstmt.setBigDecimal(1, codMensaje);
    cstmt.registerOutParameter(2, OracleTypes.STRUCT, "TYPEA");
    cstmt.execute();
    Inv inv = (Inv)cstmt.getObject(2,map);       ////////Here the exception-----------------------------------------------------------------------------------------------
    The java class Inv represents the sql object typeA as this:
    public Inv_cab cab;
    public ARRAY lins;
    And the classes Inv_cab and Inv_lin typeB and typeD with dates, BigDecimals and String.
    lins is the table of Inv_lin.
    And finally, this is the exception i get:
    java.lang.ClassCastException
    at tiposOracle.inv.Inv.readSQL(Invrpt.java:29)
    at oracle.sql.STRUCT.toClass(STRUCT.java:829)
    at oracle.sql.STRUCT.toJdbc(STRUCT.java:734)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6094)
    at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:840)
    at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:103)
    Can anyone help me?
    Thanks

    Now i get this exception in cstmt.registerOutParameter(2, OracleTypes.STRUCT);java.sql.SQLException: Conflicto de tipo de par�metro: sqlType=2002
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:248)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:402)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:471)
         at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:78)
    Conflicto de tipo de par�metro means: conflict of parameter type

  • Stored procedure output parameter cast problem

    Hi
    I call to an oracle stored procedure from java and when i get the output parameter i get a classCastException.
    The output parameter is for example of typeA
    typeA is a sql object composed by a parameter of typeB and a parameter of typeC
    typeB is a sql table of typeD objects
    and typeD, typeB are objects composed by numbers, varchar2, date.....
    I know that i have all the java to sql mappings correctly done because when my typeA is an input parameter of a procedure, it works correctly.
    But when i have it as an output parameter i can�t solve the classCastException.
    This is more or less my java code to call to the procedure:
    dbConn=DriverManager.getConnection(dnsName,dnsUser,dnsPwd);
    Map map = dbConn.getTypeMap();          
    map.put("TYPEA", Class.forName("tiposOracle.inv.Inv"));               
    map.put("TYPEB", Class.forName("tiposOracle.inv.Inv_cab"));               
    map.put("TYPED", Class.forName("tiposOracle.inv.Inv_lin"));
    CallableStatement cstmt = dbConn.prepareCall("{call GENERAL.OBTENER_MENSAJE (?,?)}");
    cstmt.setBigDecimal(1, codMensaje);
    cstmt.registerOutParameter(2, OracleTypes.STRUCT, "TYPEA");
    cstmt.execute();
    Inv inv = (Inv)cstmt.getObject(2,map);       ////////Here the exception-----------------------------------------------------------------------------------------------
    The java class Inv represents the sql object typeA as this:
    public Inv_cab cab;
    public ARRAY lins;
    And the classes Inv_cab and Inv_lin typeB and typeD with dates, BigDecimals and String.
    lins is the table of Inv_lin.
    And finally, this is the exception i get:
    java.lang.ClassCastException
         at tiposOracle.inv.Inv.readSQL(Invrpt.java:29)
         at oracle.sql.STRUCT.toClass(STRUCT.java:829)
         at oracle.sql.STRUCT.toJdbc(STRUCT.java:734)
         at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6094)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:840)
         at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:103)
    Can anyone help me?
    Thanks

    Now i get this exception in cstmt.registerOutParameter(2, OracleTypes.STRUCT);java.sql.SQLException: Conflicto de tipo de par�metro: sqlType=2002
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:248)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:402)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:471)
         at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:78)
    Conflicto de tipo de par�metro means: conflict of parameter type

  • Stored procedure and ref cursor problem

    I am trying to create a stored procedure that can be used in Crystal Reports. To do this I have to create a package and a ref cursor. My SQL is below:
    --Package
    Create or Replace Package Test_Package
    as type test_type is ref cursor;
    end;
    --Procedure
    Create or Replace Procedure Test_Proc
    (test_cursor in out test_package.test_type,
    parameter in string
    as
    begin
    open test_cursor for
    select ClientName from apbpman.cv_client where clientref = parameter;
    end;
    --When trying to execute the SP in Oracle I use:-
    set serveroutput on
    declare
    test_cursor apbpman.test_package.test_type;
    resultset test_cursor%rowtype;
    begin
    apbpman.test_proc(test_cursor,'0096');
    if not test_cursor%isopen then
    dbms_output.put_line ('OK');
    else
    dbms_output.put_line ('Not OK');
    end if;
    fetch test_cursor into resultset;
    while test_cursor%found loop
    dbms_output.put_line(resultset.ClientName);
    fetch test_cursor into resultset;
    end loop;
    end;
    Whenever this runs I receive the following error reports:
    resultset test_cursor%rowtype;
    ERROR at line 3:
    ORA-06550: line 3, column 13:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 3, column 13:
    PL/SQL: Item ignored
    ORA-06550: line 11, column 25:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 11, column 2:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 13, column 24:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 13, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 14, column 26:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 14, column 3:
    PL/SQL: SQL Statement ignored
    I have tried in vain to find a resolution to this but have failed. Please help.
    Thanks,
    Paul

    Unless you are running a really old version of Oracle, any weak ref cursor can just be declared SYS_REFCURSOR. Also, you can't use a weak ref cursor for %ROWTYPE. You can test the procedure in SQL*Plus by using it to populate a refcursor variable.

  • Problem passing REF CURSOR to JAVA STORED PROCEDURE

    Hi,
    I've written a small Java class with a static method and
    imported that into Oracle 8i. The method expects a
    java.sql.ResultSet object as parameter. According to the
    documentation of Oracle, a REF CURSOR (cursor variable) maps to
    java.sql.ResultSet in JDBC.
    The definition of the Java Stored Procedure was accepted without
    problems:
    CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
    WASTypes.GenericCurType)
    as language java
    name 'sqlj.ResultSetPassingTest.testResultSetPassing
    (java.sql.ResultSet)';
    WASTypes is a package containing the definition of the generic
    cursor:
    CREATE OR REPLACE PACKAGE WASTYPES
    is
    TYPE GenericCurType IS REF CURSOR;
    END WASTypes;
    In a function I'm opening the cursor via
    'Open cursorVariable for sqlStatement';
    Then this cursor variable is passed to the java method and the
    error ORA-03113 is shown.
    I tried to solve the problem by changing the type of the
    parameter to oracle.sql.REF without success.
    Does anybody know what wents wrong?
    Thanks in advance.
    Jan

    Hi,
    I've written a small Java class with a static method and
    imported that into Oracle 8i. The method expects a
    java.sql.ResultSet object as parameter. According to the
    documentation of Oracle, a REF CURSOR (cursor variable) maps to
    java.sql.ResultSet in JDBC.
    The definition of the Java Stored Procedure was accepted without
    problems:
    CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
    WASTypes.GenericCurType)
    as language java
    name 'sqlj.ResultSetPassingTest.testResultSetPassing
    (java.sql.ResultSet)';
    WASTypes is a package containing the definition of the generic
    cursor:
    CREATE OR REPLACE PACKAGE WASTYPES
    is
    TYPE GenericCurType IS REF CURSOR;
    END WASTypes;
    In a function I'm opening the cursor via
    'Open cursorVariable for sqlStatement';
    Then this cursor variable is passed to the java method and the
    error ORA-03113 is shown.
    I tried to solve the problem by changing the type of the
    parameter to oracle.sql.REF without success.
    Does anybody know what wents wrong?
    Thanks in advance.
    Jan

  • Error while calling stored procedure from Java

    Hi Guys,
    How are you everybody? I hope everything is goin fine on your side. I have one issue in PL/SQL while calling below stored procedures from Java.
    Problem Description: We have a stored procedure PROCEDURE BULK_INSERTS (
    V_SESSION_ID_TAB IN T_SESSION_ID_TAB_TYPE,
    V_SERVICE_TYPE_TAB IN T_SERVICE_TYPE_TAB_TYPE,
    V_SERVICE_LOCATION_TAB IN T_SERVICE_LOCATION_TAB_TYPE,
    V_SERVICE_CALL_NAME_TAB IN T_SERVICE_CALL_NAME_TAB_TYPE,
    V_SERVICE_CALL_START_TIME_TAB IN T_SERVICE_CALL_ST_TAB_TYPE,
    V_SERVICE_CALL_END_TIME_TAB IN T_SERVICE_CALL_ET_TAB_TYPE,
    V_SERVICE_CALL_DURATION_TAB IN T_SERVICE_CALL_DUR_TAB_TYPE,
    V_STATUS_TAB IN T_STATUS_TAB_TYPE,
    V_NOTES_TAB IN T_NOTES_TAB_TYPE
    ) and we are getting ora errors while calling this stored procedure from java.
    All tab types are declared locally, at package level.
    Here is error which occur while calling this sp:
    {call BULK_PKG.BULK_INSERTS(?,?,?,?,?,?,?,?,?)}
    And the parameter types we are using are:
    SESSION_ID - NUM_TAB_TYPE
    SERVICE_TYPE - VAR_TAB_TYPE
    SERVICE_LOCATION - VAR_TAB_TYPE
    SERVICE_CALL_NAME - VAR_TAB_TYPE
    SERVICE_CALL_START_TIME - DATE_TIME_TAB_TYPE
    SERVICE_CALL_END_TIME - DATE_TIME_TAB_TYPE
    SERVICE_CALL_DURATION - NUM_TAB_TYPE
    STATUS - VAR_TAB_TYPE
    NOTES - VAR_TAB_TYPE
    And the Exception stack trace is:
    ERROR (com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServi
    ceCallDAO.java:143)@ExecuteThread: '252' for queue: 'weblogic.kernel.Default') {Error attempting to save collected ESC data}
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:944)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3482)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3856)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1373)
    at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:98)
    at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.doBulkInsert(ExternalServiceCallDAO.java:220)
    at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServiceCallDAO.java:138)
    Please help my guys out of this. I will really appreciate all suggestions and advices.
    Thank you everybody.

    I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 12
    Here is example for my test procedure:
    declare
    v_session_id_tab SESSION_ID_TAB_TYPE;
    v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
    v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
    v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
    v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
    v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
    v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
    v_status_tab STATUS_TAB_TYPE;
    v_notes_tab NOTES_TAB_TYPE;
    begin
    v_session_id_tab(1) := 1;
    v_service_type_tab(1) := 'db';
    v_service_location_tab(1) := 'local';
    v_service_call_name_tab(1) := 'Name of call';
    v_service_call_start_time_tab(1) := SYSDATE;
    v_service_call_end_time_tab(1) := SYSDATE;
    v_service_call_duration_tab(1) := 100;
    v_status_tab(1) := 'Z';
    v_notes_tab(1) := 'NOTES';
    BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
    v_service_call_duration_tab, v_status_tab, v_notes_tab);
    end;
    I declare all types at schema level.
    Please give your comments.
    Thank you

  • Could not find stored procedure

    Dear gurus,
    I am working, for the first time, on a SAP BPC ( MS ) demo.
    I have created a new input schedule based on a dynamic template, with some modifications.
    However when I try to submit data, it gives an error:
    "Could not find stored procedure 'dbo.up_ConcurrentLockDEL_HR'.;"
    DEL_HR is my application and is based on a existing one "FINANCE", but I have added new dimensions and deleted another ones.
    I can not understand this message because I don't know where I define stored procedures. I also commented all script logics that this application had.
    Could you help me on this?
    Best regards,
    Vitor Ramalho

    Hi Vitor,
    You need to login to the server, where SQL has been installed. You can login to that system using remote desktop connection.
    Once you login to the SQL server, under the databases, you will find your application set. Expand it and navigate to Programmability and then to Stored Procedures. Here, you will get all the stored procedures.
    The above statements will guide you to find the stored procedures. However, the problem, we are looking at is little different. Usually, with every application, a stored procedure with the name, "dbo.up_ConcurrentLockappname" gets created automatically. However, I am guessing that this stored procedure is not available for your application. Search for the stored procedure just to make sure that its available or not. If its not available, search for dbo.up_ConcurrentLockFinance. I am asking to search for the Finance one since your application is copy of the Finance application. So, just to make sure that the source application is fine. If this stored procedure is present but the stored procedure for your application is not present, then I would suggest you to create the application once again. Process it properly.
    Hope this helps.

  • Using an IN Clause in a Stored Procedure

    Hello All:
    I have come to the conclusion that my stored procedure is having a problem with the use of an IN clause using a parameterized query.
    I have in my Stored Procedure the following: AND oh.status_flag IN (p_OrderStatus)
    The p_OrderStatus will contain values along the lines of:
    1). p_OrderStatus = 'X'
    2). p_OrderStatus = 'X', 'S', 'W'
    In my .Net code, I am setting the parameter value as being:
    oCommand.Parameters.Add("p_OrderStatus", OracleDbType.Varchar2).Value = Status;
    However: this isn't working as something in the IN clause doesn't seem to work as I expected, but if I do the same query through a TORA window, it brings back values.
    What is causing this to stop working once I move it to a Stored Procedure and how do I fix it (either the .Net side or the Oracle Side, which I assume it would be something on the Oracle side of things).
    Any help is greatly appreciated
    Thanks
    Andy

    One way I've found to get around this is to have .net pass in a comma seperated list of values into the procedure, then have the procedure split it up into a table and use that in the IN. There's probably a better way to do it, but this works:
    create or replace
    TYPE "STRINGTABLETYPE" AS TABLE OF VARCHAR2(30);
    create or replace
    FUNCTION "FUNC_STR2STRTBL"
    ( p_str in varchar2 ) return
    stringTableType
    as
    l_str long default p_str || ',';
    l_n number;
    l_data stringTableType := stringTabletype();
    begin
    loop
    l_n := instr( l_str, ',' );
    exit when (nvl(l_n,0) = 0);
    l_data.extend;
    l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
    l_str := substr( l_str, l_n+1 );
    end loop;
    return l_data;
    end;
    Then in your actual query procedure, you can do something like this:
    SELECT * FROM table WHERE column IN (select * from THE (select cast(FUNC_STR2TBL(parameter) as STRINGTABLETYPE) from dual))

  • How to call a sql stored procedure in java...... HELP

    Hi I am making an application for taking backup in sql automatically so i have created a dts package which is called by a stored procedure. Now the problem is that how to call that stored procedure in a Java program so that after running my java program i get my database backup.
    Please please solve my problem.
    thanks in advance.
    If possible please send the code.
    Message was edited by:
    Andy_Davis
    Message was edited by:
    Andy_Davis

    Hi... I am trying to create a dts package which is called by a stored procedure... How can i do this? IF possible can you please send me the code as well..
    Thanks a ton...
    Susan_Davis

  • URGENT!!! a way to find out if Oracle stored procedures have OUT parameters

    I'm having problemes properly creating a string for the prepareCall().
    so that i can call up a stored procedure in oracle.
    the problem is that some stored procedures have OUT parameters that I have to register, and some stored procedures don't.
    how can i find out if a stored procedure has an OUT parameter or not?
    So that i can format a string with one less ? for statements that don't,
    and one more ? for statements that do have an OUT parameter.
    is there such a method as boolean OUTparameterExist();
    or i'll take any suggestions.

    any other solutions?That was the solution. You don't need to execute any sql statement to get Database Meta Data. You just need a connection, which you use to get the DatabaseMetaData instance
    DatabaseMetaData dbmd = connection.getMetaData();then invoke any of the (numerous) methods to get the info you require
    ResultSet rs = dbmd.getProcedureColumns("mydb","myschema","myproc",null);
    while(rs.next()) {
      String name = rs.getString("COLUMN_NAME");
      if (rs.getShort("COLUMN_TYPE")==DatabaseMetaData.procedureColumnOut) {
        // column is an OUT parameter
    }Dave

  • How to call stored procedure in ASP pages

    After I migragate MS SQL server database to Oracle 8i database, all the call to stored procedure in ASP has problems. I have been had a problem to find some document about how to call oracle stroed procedure from SQL*plus or using ADO. If anybody can help me to find any resource about it. or better give me some examples, that will be very helpful.
    Thanks!
    null

    If you have account on Metalink.
    Please go there and do a search on ASP.
    There you can find, how to call SP from
    ASP.
    If you have problem finding this let
    me know.
    I will try to find it

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

  • WL 6.0 using MS SQL Server 2000 - Transaction timeout when invoking stored procedure

    Hi,
    Facing a problem on WL6.0. We are connecting to MS SQL server 2000 using a stateless
    session bean
    using container managed transaction. The bean method does a few updates to the
    database and also
    calls a stored procedure that generates primary keys many times. This stored procedure
    (SP) is running
    in a transaction of its own since it has to increment a counter, update the database
    and then return the
    primary key.The primary key generator SP is working fine and does not lock the
    database in many bean
    methods.
    In some methods we find that the primary key generator SP has locked the database.
    We
    then see a lock on the database created due to this SP in the MS SQL client. The
    execution goes
    into the SP and gets stuck there till the bean's transaction times out. The error
    message given is
    ...... .. Exception Message - The transaction is no longer active
    (status = Rolling Back. [Reason = weblogic.transaction.internal.TimedOutExcepti
    on: Transaction timed out after 31seconds
    tx = transaction=(IdHash=1746718,Name = [EJB StructMgrBeanImpl.addStructure()],X
    id=10908:51e67e9d7185816a,Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=
    0,seconds since begin=31,seconds left=30,activeThread=Thread[ExecuteThread: '7'
    for queue: 'default',5,Thread Group for Queue: 'default'],ServerResourceInfo[web
    logic.jdbc.jts.Connection]=(state=started,assigned=none),SCInfo[myserver]=(state
    =active),properties=({weblogic.transaction.name=[EJB StructMgrBeanImpl.addStruct
    ure()], weblogic.jdbc=t3://10.200.15.136:7001}))]). No further JDBC access is
    al
    lowed within this transaction.
    What could be the potential problems in the method's code/SP that could be causing
    the timeout?
    Anyone faced similar problems?
    Thanks in advance,
    Sreeja

    Hi,
    Facing a problem on WL6.0. We are connecting to MS SQL server 2000 using a stateless
    session bean
    using container managed transaction. The bean method does a few updates to the
    database and also
    calls a stored procedure that generates primary keys many times. This stored procedure
    (SP) is running
    in a transaction of its own since it has to increment a counter, update the database
    and then return the
    primary key.The primary key generator SP is working fine and does not lock the
    database in many bean
    methods.
    In some methods we find that the primary key generator SP has locked the database.
    We
    then see a lock on the database created due to this SP in the MS SQL client. The
    execution goes
    into the SP and gets stuck there till the bean's transaction times out. The error
    message given is
    ...... .. Exception Message - The transaction is no longer active
    (status = Rolling Back. [Reason = weblogic.transaction.internal.TimedOutExcepti
    on: Transaction timed out after 31seconds
    tx = transaction=(IdHash=1746718,Name = [EJB StructMgrBeanImpl.addStructure()],X
    id=10908:51e67e9d7185816a,Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=
    0,seconds since begin=31,seconds left=30,activeThread=Thread[ExecuteThread: '7'
    for queue: 'default',5,Thread Group for Queue: 'default'],ServerResourceInfo[web
    logic.jdbc.jts.Connection]=(state=started,assigned=none),SCInfo[myserver]=(state
    =active),properties=({weblogic.transaction.name=[EJB StructMgrBeanImpl.addStruct
    ure()], weblogic.jdbc=t3://10.200.15.136:7001}))]). No further JDBC access is
    al
    lowed within this transaction.
    What could be the potential problems in the method's code/SP that could be causing
    the timeout?
    Anyone faced similar problems?
    Thanks in advance,
    Sreeja

Maybe you are looking for

  • How to create a muli line text area using JavaFx

    Hi all, Since the preview SDK does not contain TextArea any more, I am wondering how to create a muli line text area using JavaFX. The behaviour of this text area/field should be somehow similar to JTextArea in Swing or StyledTextWidget in SWT. Does

  • Lots of Stuff Wrong--Chief Among Them OS X Won't Boot

    I did the Quicktime update that came out a few days ago... When I restarted, everything went okay until the "Mac OS X" screen. It went about a half a centimeter on the progress bar in the "Mac OS X" window and then the window disappeared and I was fa

  • Business Partner replication from ECC to CRM based on Company code

    Hi: I got this requirement where we need to transfer customers from ECC --> CRM. Customers specific to a company code. Trying to maintain Filters for  CUSTOMER_main--> KNB1- BUKRS to filter customers by a certain company code.  I get this error " Tab

  • Issue with Minus Query

    Hello All, I am using oracle database 10.2.0.4 in windows server. I am doing data comparision for 2 set of query using the minus operator with same condition. My 1st query is giving 23 rows and 2nd query is giving 20 rows. The output should be 3 rows

  • Contact list deleted

    My iPhone has randomly deleted my contacts list. I have not updated to OS6 and wasn't fiddling with any of the iCloud options. I went through and manually redid my contacts list and then it was deleted again. What is the problem? Will it stop if I up