transaction in a procedure

Hello
I've implemented this procedure but I don't know about the syntax.
I have 4 operations. The examples I've looked at don't seem to have the 'end' between each transaction. I don't know how word error messages, I have I don't have one, when you insert values.
I think I have the right to record.
An example I looked said to name the transaction as I did and the other example said to set the name of the transaction to 'rollback_rs1.
Is how important it?
I have to name each transaction (1,2,3,4)? I do not think, but yet again, I'm not sure.
I use oracle 10.2.0.3
Here is the table, it is emptey at this time.
{code}
Catalogue of DROP TABLE CASCADE CONSTRAINTS;
CREATE TABLE catalog
(NUMBER OF NOCS,
Varchar2 (25) CTITRE,.
CREATED_BY varchar2 (30),
CREATED_DATE date,
UPDATED_BY varchar2 (30),
Date of UPDATED_DATE);
{code}

my surgery is lower with comments where I don't know if I'm right.
-It comes to question3. create a procedure
-who will perform the operations of insertion of values in the catalog table.

{code}
CREATE OR REPLACE PROCEDURE week_11
Start
Set transaction read write catalogue name - is that correct?

Insert into catalog
VALUES ("cmis420", "Advanced Relational Database", "Bill Warren', sysdate,"Jean Todd", sysdate);
Insert into catalog
VALUES ('CMST385', 'Introduction to XHTML', 'Terry Woods", sysdate, 'john Miller', sysdate);

SAVEPOINT cmis420_cno;

EXCEPTION - is this true or do I have to use the clause "IF"?
while others then
dbms_output.put_line (SQLERRM);
Rollback; -If an error occurs rollback.
-I don't know how to do this part... display message if an error occurred, then roll back the transaction.

Insert into catalog
VALUES ('cmst170', 'Introduction to XML', ' richard Jones, sysdate, 'Mary Smith', sysdate);
Insert into catalog
values ('CMIS315', "Programming in C++", "richard Jones, sysdate, 'Paul Todd', sysdate);
SAVEPOINT cmst170_cno;
exception
while others then
dbms_output.put_line (SQLERRM);

Rollback; -If an error occurs rollback.
-I don't know how to do this part... DisplayMessage if an error occurred, then roll back the transaction.


Insert into catalog
values ('CMIS111', ' Social Networking and cybersecurity best practices, "Terry Woods", sysdate, 'john Miller', sysdate); »
Insert into catalog
values ('CMIS125', in Programming', sysdate, c# ', "richard Jones, sysdate, Peter Greenburg, sysdate);
SAVEPOINT cmis111_cno;

exception
while others then
dbms_output.put_line (SQLERRM);

Rollback; -If an error occurs rollback.
-I don't know how to do this part... display message if an error occurred, then roll back the transaction.


Insert into catalog
values ('CMIS225', 'Windows Presentation Foundation (WPF) development', "George Allen", sysdate, 'Richard Jones' sysdate);
Insert into catalog
values ('CMIS465', 'Software' and Validation, sysdate, 'Bill Warren', sysdate, "Jean Todd");

SAVEPOINT cmis225_cno;

exception
while others then
dbms_output.put_line (SQLERRM);
backup restore point cmst170_cno; -If an error occurs rollback transaction 2 using the restore.
-I don't know how to do this part... display message if an error occurred, then roll back the transaction.
end;
commit;
{code}

I appreciate any help you can give
kabrajo

Published by: BluShadow on August 15, 2011 13:00
Add tags {noformat} {code} {noformat}. Please read {message identifier: = 9360002} to learn how to do it yourself.

Closer-
If you want an exception handler in the inserts, you use this structure:

BEGIN
    (your code, inserts, whatever)
EXCEPTION
     WHEN (what you are trapping)
END;

If you are missing this syntax.

Insert into catalog
VALUES ("cmis420", "Advanced Relational Database", "Bill Warren', sysdate,"Jean Todd", sysdate);
Insert into catalog
VALUES ('CMST385', 'Introduction to XHTML', 'Terry Woods", sysdate, 'john Miller', sysdate);

EXCEPTION
WHILE OTHERS THEN


DBMS_OUTPUT. Put_line (' error insertion class: ': substr (SQLERRM, 1, 75));
ROLLBACK;

I don't know your needs, but you should review the logic here and see if that's really what you intend to happen. You do: insertion of 2 lines. If there is an error message on the screen. Then, because ERROR has BEEN HANDLED, your program will pronounce on the next 2 inserts, etc. If that's what you intend, very well, but from my experience, this is not the typical requirement.

It is also very important out of the habit of using SO many OTHER as your exclusive exceptions management method. Much more appropriate in this case would be:

WHEN DUP_VAL_ON_INDEX THEN    (whatever particular error you might raise)
     (insert or whatever)
WHEN OTHERS THEN
     (code for something unexpected)
END

If you have access, I highly recommend you PL/SQL of Steven Feuerstein, programming books - starting with "Oracle PL/SQL Programming" - they are very clear, use step by step explanations syntax and correct usage and I think I have more information on the net that you can download to use with examples in the book. I learned all that I know (PL/SQL) Steven. This can reduce the confusion see several examples that have discrepancies in the documentation.

Good luck!

Tags: Database

Similar Questions

  • Transaction in stored procedure not treated as Atomic?

    Hello

    I have a stored procedure that inserts a line in a table called reservations and also decrement the places available for an event.

    For example: at an event, there are 100 places available. After you add a reservation, it will be left only 99 seats.

    I also have a Java program that sends 100 concurrent transactions to the database.

    After 100 transactions, there are 100 reservations, but there are still about 60 free places.

    So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

    The code of the stored procedure:

    create or replace PROCEDURE procedureOne (s_price, NUMBER, NUMBER, of s_customer)

    s_event NUMBER, DATE, s_movie NUMBER of s_dat)

    IS

    s_ev NUMBER;

    s_free NUMBER: = 0;

    BEGIN

    commit;

    Set transaction read write;

    Start

    SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

    Select Event_ID, Free_seats EN s_ev, s_free

    events

    where ID_Movie = s_movie;

    If s_free > 0 then

    Start

    update events set Free_seats = s_free-1;

    insert into values of reservations (seqa_seq. NEXTVAL, s_dat, s_customer, s_event, s_price);

    commit;

    end;

    on the other

    Start

    Rollback;

    end;

    end if;

    end;

    commit;

    end procedureOne;

    invatacelul wrote:

    So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

    You said: "I also have a Java program that sends 100 concurrent transactions to the database. Atomicity applies to a single transaction - it says transaction executes all or nothing. Is what you run in isolation. If you want isolation unless you serialize, transaction 2 sees no uncommitted transaction 1 results because the READ COMMITTED isolation level indicates that a transaction can read only the data that has been committed to the database. And since you wrote your code as SELECT + UPDATE you get results you never expected. Use:

    UPDATE OF EVENTS

    SET FREE_SEATS = FREE_SEATS - 1

    WHERE ID_Movie = s_movie

    AND FREE_SEATS > 0;

    SY.

  • transaction isolation stored procedure-level testing

    Hello

    I want to study the concurrency in the Oracle database using stored procedures in pl/sql with different transaction isolation levels.

    The idea is to send to the database of a number "n" of simultaneous transactions where n can be {100, 200, 400, 1000} and for each isolation level (READ COMMITTED, SERIALIZABLE) to determine the number of transactions committed, how much data, run time incorrect.

    The question is how can I generate n transactions that run simultaneously on the data base and how to get these results. I understand that this task can be done as well by using pl/sql stored procedure in the database or inside a JSP Java web application. Advantages/disadvantages?

    I should mention that I'm a begginner in Oracle...

    Thank you in advance.

    You want to run a large number of asynchronous (parallel) transactions.

    Although this can be done by running the Oracle's work, I think it is easier to work with the client side, using a Java program (for example).

    It doesn't have to be a web application (for example. JSP), can be a client Java that uses Java threads, and each thread is using a single database connection (and the corresponding database session).

    Kind regards

    Zlatko

  • Procedure to insert several lines

    create or replace procedure relevent_doc_after_insert (JOBNUMBER IN varchar2,
    DOCNAME IN VARCHAR2)
    IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    vDocName VARCHAR2 (80);

    CURSOR insertAfterdata
    IS
    SELECT mnd_doc_name
    OF clm_min_doc_to_process
    WHERE mnd_doc_name! = DOCNAME;


    BEGIN
    OPEN insertAfterdata.
    LOOP
    EXTRACTION insertAfterdata
    IN
    vDocName;

    EXIT WHEN insertAfterdata % NOTFOUND;

    INSERT INTO clm_relevent_doc (rd_id,
    rd_job_no,
    rd_doc_name,
    rd_created_user,
    rd_created_date,
    rd_status)
    VALUES (relevant_doc_sequence. NEXTVAL,
    JOBNUMBER,
    vDocName,
    'system ', he said.
    To_char (SYSDATE, "yyyy-mm-dd HH12:MI:SS"),
    'pending');

    COMMIT;
    END LOOP;
    CLOSE InsertAfterdata;

    EXCEPTION
    WHILE OTHERS THEN
    NULL;

    END;



    Above is my procedure

    I pass below the settings during the execution
    JOBNUMBER = 123
    DOCNAME = driving licence



    When the CURSOR query get the 3rows as a result but insert several rows in the clm_relevent_doc table, why did this happen.

    It does not work properly, is it not? If this isn't the case, then please point where.

    Also as knani questioned, and so I did (although not confirmed), you really need the independent transaction? can you justify using autonomous transactions, in this procedure?

    select *
      from clm_min_doc_to_process;
    
    MND_ID                 MND_DOC_NAME       MND_DOC_CODE
    ---------------------- ------------------ --------------------
    1                      Driving Licence    DL
    2                      SA Report          SARPT
    3                      Estimate           EST
    4                      Photos             PHOT    
    
    select *
      from clm_relevent_doc;
    
    RD_ID                  RD_JOB_NO       RD_DOC_NAME    RD_CREATED_USER   RD_CREATED_DATE  RD_ADD_DOC_NAME  RD_UPDATE_USER   RD_REQUEST RD_REQUEST_METHOD RD_STATUS RD_RECEIVED_DATE_TIME
    ---------------------- --------------- -------------- ----------------- ---------------- ---------------- ---------------- ---------- ----------------- --------- --------------------- 
    
    set serveroutput on;
    begin
      relevent_doc_after_insert(123, 'Photos');
    end;
    
    anonymous block completed
    3 rows inserted
    
    select *
      from clm_relevent_doc;
    
    RD_ID                  RD_JOB_NO       RD_DOC_NAME     RD_CREATED_USER RD_CREATED_DATE     RD_ADD_DOC_NAME RD_UPDATE_USER RD_REQUEST RD_REQUEST_METHOD RD_STATUS RD_RECEIVED_DATE_TIME
    ---------------------- --------------- --------------- --------------- ------------------- --------------- -------------- ---------- ----------------- --------- ---------------------
    1                      123             Driving Licence system          2013-01-21 06:43:23                                                             pending
    2                      123             SA Report       system          2013-01-21 06:43:23                                                             pending
    3                      123             Estimate        system          2013-01-21 06:43:23                                                             pending                        
    
  • MySQL stored procedure syntax errors

    I have a request online, I want to use transactions either commit all updates of db or anything. The code I created is as follows, not only am I getting an error of syntax on lines 5 and 16, but frankly I do not know that the code is really going to do what I want. Please let me know if you see syntax errors and explain them.

    CREATE PROCEDURE increase_maint_priority
        (maint_item INT, new_priority INT, cur_priority INT, center_id INT)
     
    BEGIN
        START TRANSACTION; -- line 5 syntax error
        -- start updates
        UPDATE maintitem SET priority = (priority+1) 
            WHERE priority > cur_priority
            AND priority <= new_priority
            AND centerID = center_id;
            
        UPDATE maintitem SET priority = new_priority
            WHERE id = maint_item;
        
        COMMIT;
    END; -- line 16 syntax error
    

    Thank you in advance for helping a newb to stored procedures.

    If you want to help me to know if this code will actually work for what I want, that the following describes the situation.

    Main idea: business location apply for maintenance at their Center. Applications can be added anywhere in the list of priority (1 = highest priority). They can also change the priority of an application at any time.

    Previously I was using php to control a loop of update mysql queries (ouch, I know now, 2 sql statements could do the trick) and we live lately priorities in double, and other problems which seem to be very likely related to the update of the priorities of several elements.

    Ex: moving priority 6 to priority 1 requires 1 update query because the current priority of the 6th point, but a second query (or loop of several others since I am very new to the drafting 2 years ago sql statements) to update the other priorities.

    Thus, the desire for transaction method.

    Once again, thanks in advance for any help on this matter.

    PS - I use MySQL workbench to write this and it's where to find errors.

    I do not use MySQL and its syntax is slightly different from the other DBMS stored procedures. In all cases, once you eliminate the warning, you also add a handler to ensure that updates roll back in case of error:

    http://khanrahim.WordPress.com/2010/05/16/transaction-with-stored-procedure-in-MySQL-serve r.

  • Delete records parent and child

    Hi all, hope you can help. I was wondering what the most effective method is to do this:

    There are 3 tables involved.

    TBL_APPLICATION (appl_no (PK))
    TBL_ROOM (appl_no (FK))
    TBL_ROOM_MATE (appl_no (FK))

    TBL_APPLICATION is the main table and has a 1 to many times TBL_ROOM & TBL_ROOM_MATE relationship.


    I have 80 files or that I need to remove TBL_APPLICATION and atomically delete their child references in the TBL_ROOM & TBL_ROOM_MATE as well.

    I looked at a procedure that allows you to select each app_no and removes references to the child first and then countering to TBL_APPLICATION.

    Some tips and examples would be much appreciated, as it is important I don't mess this place and I want to keep each atomic transaction incase something breaks down. : D

    Thank you very much

    oraCraft wrote:
    Arrays do not have the Delete Cascade game, nor can I change the table. So I can't use it. I will implement the procedure.

    Tubby if I had to create a cursor and loops on each App_no running the three remove commands, is completely Atomic? as he used complete unless all orders delete three are made to the database. ? Also will I commit in the loop or outside it?

    Do not use a loop, all that will do is to add massive amounts of overhead to the procedure.

    Perform deletions as I pointed out, this is your best bet.

    Regarding the commitment, which is really for you. Generally, you should not be committed in your routines, that should be the responsibility of the calling application so that it can determine the transaction limits.

    If you have added a validation of the code, you would add a commit only after the statement of final deletion, which would preserve the integrity of the transaction in this procedure, but again, adding a commit procedure means you have mandated that a transaction includes, who can not fly with applications by calling the procedure.

  • How to make the file spal in orcel apex

    Hello!
    I know that google is my best friend but he doesn't know. I hope you can help and how to make a spol file? Thank you!

    Published by: user12163960 on December 23, 2009 12:37 AM

    coil is a SQL * more is not part of the Apex feature.

    Apex runs on the database server should so no interface output (to serve web pages share) coil or write the output to.

    What exactly are you trying to do?

    If you try to follow or to record things, you can better use an autonomous transaction in a procedure that writes data to a trace/logging table.
    Alternatively, you can call a procedure of apex that uses the UTL_FILE database package to write something in a file on the database server.

    With APEX, you will not be able to be rolled up or write the data directly to a file on the client computer as that violates all sorts of web protocols around security. Apex can generate files on the server and then serve those through the web browser, such as when it generates files Excel etc., but this isn't quite what you're looking for seems to me.

  • How can we check that the data already exist in the database

    Hi friends

    I'm trying to create a procedure for adding clients in the database with the customer id as input parameter... but if the customer details database already exists that I would update this detail and is not in the database I want to add this detail in the database... How could I do that...

    any help would be appreciated

    Thank you
    Rommy

    Hello

    If your condition is to add to a table, and if the record exists in the other table, the merge statement does not work

    Example (Please check the column name and the parameter names). I do not commit or rollback because I do not know if you control the transaction within this procedure or outside it.

    CREATE OR REPLACE PROCEDURE add_cust(I_CUST_ID        IN VARCHAR2,
                                         I_CUST_F_NAME    IN VARCHAR2,
                                         I_CUST_L_NAME    IN VARCHAR2,
                                         I_CUST_ADD       IN VARCHAR2,
                                         I_CUST_CITY      IN VARCHAR2,
                                         I_CUST_STATE     IN VARCHAR2,
                                         I_CUST_ZIP       IN VARCHAR2,
                                         I_CUST_DOB       IN DATE,
                                         I_CUST_          IN VARCHAR2,
                                         I_CUST_ACCT_TYPE IN VARCHAR2,
                                         I_START_BAL      IN NUMBER) IS
    BEGIN
       INSERT INTO CUSTOMERS C
          (CUST_ID,
           CUST_F_NAME,
           CUST_L_NAME,
           CUST_ADD,
           CUST_CITY,
           CUST_STATE,
           CUST_ZIP,
           CUST_DOB,
           CUST_)
       VALUES
          (I_CUST_ID,
           I_CUST_F_NAME,
           I_CUST_L_NAME,
           I_CUST_ADD,
           I_CUST_CITY,
           I_CUST_STATE,
           I_CUST_ZIP,
           I_CUST_DOB,
           I_CUST_);
    
    EXCEPTION
       WHEN DUP_VAL_ON_INDEX THEN
          INSERT INTO CUSTOMER_ACCT
             (CUST_ID,
              CUST_ACCT_NO,
              cust_acct_type)
          VALUES
             (I_CUST_ID,
              CUST_ACCT_SEQ.NEXTVAL, -- CUST_ACCT_SEQ is a sequence, isn't?
              I_CUST_ACCT_TYPE);
    
    END add_cust;
    

    Kind regards

  • Work Dbma_scheduler execution of procedure which loops through all the customer drawings in the rear rollers database transaction in case of exception

    Hello

    Need your contributions on the approach to implement a work using dbms_scheduler.

    We have about 2000 drawings. Each schema has a package with 2 procedures.

    The requirement is to create a single job in SYS that loop over each schema and run the procedures specific to a time (once a day) and send a notification by e-mail on success or failure.

    Working script:

    BEGIN

    dbms_scheduler.create_job (job_name = > 'LOAD_EACH_SCHEMA_AUDIT_DATA',)

    job_type = > 'PLSQL_BLOCK ',.

    job_action = > ' BEGIN sys.p_loadaudit;

    END;',

    start_date = > systimestamp,

    repeat_interval = > ' FREQ = MINUTELY; RANGE = 1',

    number_of_arguments = > 0,

    enabled = > true,

    Comments = > "Use repeat interval is every five minutes");

    END;

    /

    Note: to test the end I put him repeat interval to carefully.

    Use of procedure must be running:

    Procedure sys.p_loadaudit:

    CREATE OR REPLACE

    PROCEDURE p_loadaudit

    AS

    v_count NUMBER: = 0;

    lv_error_message VARCHAR2 (4000);

    vstmt VARCHAR2 (4000);

    BEGIN

    I'm IN

    (SELECT username FROM dba_users WHERE username LIKE '% ABCFIRM')

    )

    LOOP

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_coa; end;';

    EXECUTE immediate vstmt;

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_am; end;';

    EXECUTE immediate vstmt;

    END LOOP;

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure p_loadaudit: ' | SQLCODE. "- ERROR -" | SUBSTR)

    SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    raise_application_error(-20002,lv_error_message);

    END p_loadaudit;

    /

    Example of a scheme: SCHEMA_01

    create or replace

    PACKAGE pkg_audit_info

    AS

    CursorType type

    IS

    REF

    CURSOR;

    PROCEDURE p_load_COA;

    PROCEDURE p_load_AM;

    END pkg_audit_info;

    /

    create or replace

    Pkg_audit_info body PACKAGE

    AS

    PROCEDURE p_load_COA

    AS

    BEGIN

    INSERT INTO TABLE1();

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure pkg_audit_info.p_load_COA: ' | SQLCODE

    || "- ERROR -" | SUBSTR (SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    RAISE_application_error(-20002,lv_error_message);

    END p_load_COA;

    PROCEDURE p_load_AM

    AS

    BEGIN

    INSERT INTO TABLE2();

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure pkg_audit_info.p_load_AM: ' | SQLCODE.

    "- ERROR -" | SUBSTR (SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    RAISE_application_error(-20002,lv_error_message);

    END p_load_AM;

    END pkg_audit_info;

    /

    Table1 and table1 exist in schema_01.

    All 2000 patterns have same package.procedures.

    For security reasons, I removed the actual code.

    I was able to complete the task successfully. However, when a scheme procedure (SCHEMA_01.pkg_audit_info.p_load_COA) throws an exception, the job fails, and any transaction is rolled back.

    Is it possible to loop through each schema and run the corresponding procedures. Even if the exception occurs, it must restore only for this scheme and continue other patterns in the loop?

    Please let me know if there is a better way to do this. Is the way I'm handling exceptions in the work or the correct procedure?

    Thank you

    Hello

    RAISE_APPLICATION_ERROR will cause the program to exit to the appellant, even if you put it inside a block in the loop, so the statement RAISE or RAISE_APPLICATION_ERROR must be placed in your procedures 'pkg_audit_info.p_load_AM' and 'pkg_audit_info.p_load_coa '. In this way, you can use a block inside the loop and the error in the log.

    I'm IN

    (SELECT username FROM dba_users WHERE username LIKE '% ABCFIRM')

    )

    LOOP

    BEGIN

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_coa; end;';

    EXECUTE immediate vstmt;

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_am; end;';

    EXECUTE immediate vstmt;

    EXCEPTION

    WHILE OTHERS THEN

    --> Set the error in a table of otherwise custom event log you won't know what happened for this scheme: don't forget the user name

    END;

    END LOOP;

  • I bought a package of cloud, but he regretted later. I want to cancel the transaction, not available any document generated by buying. What is the procedure?

    I bought a package of cloud, but he regretted later. I want to cancel the transaction, not available any document generated by buying. What is the procedure?     I bought a package of cloud, but he regretted later. I want to cancel the transaction, not available any document generated by buying. What is the procedure?                                                       I bought a package of cloud, but he regretted later. I want to cancel the transaction, not available any document generated by buying. What is the procedure?

    Hi Marine,

    Please contact support by calling/chat for cancellation requests and billing queries:

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    You can also check the help below document:

    https://helpx.Adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

    Kind regards

    Sheena

  • Tab of transaction in the ODI procedure

    Hi Experts,

    Can anyone help me on what and how exactly the Transaction tab in step ODI procedure? Thank you!

    Best regards,
    VERIFIED BY VISA

    Hello

    I take you means the deposit Transaction on a step in the procedure box?

    That you can use to isolate operations within the session and commit at the end. For example, if you want to load data from various sources in a table, you can set the Transaction for each step of the procedure on the same value of transaction isolation, with the 'Commit' as 'No commit' and when all data are loaded in the table, having a validation step in your procedure to validate this specific transaction. If for any reason, a step fails, then no data within this transaction will be validated in the database.

    Its the same as using SQL Developer and have auto commit turned off. You must manually validate the database if you want to see changes to data in another session, or you can role back your changes within the session if you do not want to commit them.

    Take a look at the 'IKM Oracle incremental update' IKM - it uses 1 Transaction on these steps, both have a specified "No. Commit":

    "update existing lines"
    "Insert new lines."
    then has a specific validation step thereafter.

    I hope this helps.

    See you soon

    BOS

  • Transaction number when calling a stored procedure in osb

    Hi all

    I created a wrapper procedure to call "soa.delete_instances (this procedure will remove instances of schema SOA_INFRA)" oy locall created the user schema (ASG).

    If I run the direclt wrapper procedure in SqlDeveloper it works fine clean bodies.

    I called this procedure in OSB using the JCA adapter DB file, the procedure of the wrapper is the fine workmanship, but does not remove instances of schema SOA_INFRA.

    any help is nice.

    Thank you...

    I used data XA NO source instead of XA my problem solved.

    Thanks for the replies.

  • Problem with stored procedure and validation

    I have the following stored procedure:

    create or replace PROCEDURE SOME_PROC)

    /*

    Some settings

    */

    ) AS

    NUMBER of errors

    BEGIN

    errors: = FN_CHECK_BUSINESS_RULE_1 (/ * some args * /);

    if(Errors > 0) then

    raise_application_error (ERR_CONSTANTS. SOME_ERROR_NUMBER, ERR_CONSTANTS. SOME_ERROR_MESSAGE);

    end if;

    INSERT INTO une_table (/ * columns * /) VALUES (/ * values * /);

    END SOME_PROC;

    Because the business rule 1 is placed inside the stored procedure I can't check it out without calling the stored procedure.

    I need to call the stored procedure 10 times with a different set of parameters and validation of the changes only after all calls to the stored procedure

    are successful. I want to show the user all the errors that occurred during the stored procedure calls. If for a first example of stored procedure call

    succeeds and a second failure no data has to be stored in a database.

    How to prevent the stored procedure for insert lines until I call the method commit of ApplicationModule?

    Thanks in advance.

    No, other users only see the lines until you commit. The search term is the transaction isolation level. Tom Kite write a paper on this here ask Tom: on transaction isolation levels. This article gives some samples, according to theory, and you should read it.

    Timo

  • DBMS_REDEFINITION "the transaction is in doubt."

    Hi all

    I have a problem with the DBMS_REDEFINITION package. Our application does have a problem. very basically, I just want to a partitioned table. This table is very active, especially inserts and deletes. I create partitined table, that the can_redef_Table procedure to no control, no error when I run the procedures START_REDEF_TABLE or COPY_TABLE_DEPENDENTS, the application starts to get "the transaction is in doubt," error for all operations that the use of this table. A c# .net application is, I don't have a lot of information about this (I know if it's necessary). Here is a simple code I used.

    PS: our database is oracle 11g r2, 1/8 exadata.

    CREATE TABLE T1
    (ID     NUMBER(38) PRIMARY KEY,
    MYDATA VARCHAR2(80),
    MYDATE DATE);
    
    CREATE TABLE T1_PART
    (ID     NUMBER(38),
    MYDATA VARCHAR2(80),
    MYDATE DATE)
      PARTITION BY RANGE (MYDATE) INTERVAL (NUMTOYMINTERVAL('1','MONTH'))
        (PARTITION P1 VALUES LESS THAN (TO_DATE('01/01/2010', 'dd/mm/yyyy')));
    
    
    EXEC DBMS_REDEFINITION.Can_Redef_Table(USER, 'T1');   
    
    exec DBMS_REDEFINITION.START_REDEF_TABLE(UNAME => USER, ORIG_TABLE=>'T1', INT_TABLE=>'T1_PART');   
    
    BEGIN
      dbms_redefinition.sync_interim_table(
        uname      => USER,       
        orig_table => 'T1',
        int_table  => 'T1_PART');
    END;
    /
    
    DECLARE
      l_errors NUMBER;
    BEGIN
      DBMS_REDEFINITION.copy_table_dependents(uname => USER, orig_table => 'T1', int_table =>
      'T1_PART', copy_indexes => DBMS_REDEFINITION.cons_orig_params, copy_triggers => TRUE,
      copy_constraints => TRUE, copy_privileges => TRUE, ignore_errors => FALSE, num_errors => l_errors
      , copy_statistics => false, copy_mvlog => false) ;
    
    END;
    /   
    
    
    BEGIN
      dbms_redefinition.sync_interim_table(
        uname      => USER,       
        orig_table => 'T1',
        int_table  => 'T1_PART');
    END;
    /
    
    
    BEGIN
      DBMS_STATS.GATHER_TABLE_STATS(USER, 'T1_PART', degree => 8);
    END;
    /
    
    BEGIN
      dbms_redefinition.finish_redef_table(
        uname      => USER,       
        orig_table => 'T1',
        int_table  => 'T1_PART');
    END;
    /
    
    
    

    Any idea? Thank you.

    > I just found something. Since our .net application uses the method of distributed transaction (as I understand)

    I am interested in this, if you can ask your .net developers - on this page:

    https://TechNet.Microsoft.com/en-us/library/bb896149 (v = sql.110) .aspx

    There is an example 'TransactionScope example 3.

    It shows that the two operations are established, internal and external (nested), and each uses its own connection.

    I was wondering if the two transactions (who work in the connections of different database and database sessions) work together as one "logical transaction", IE. as XA distributed transaction.

    I looked at the documentation for the TransactionScope to the page:

    https://msdn.Microsoft.com/en-us/library/ms172152.aspx

    but I couldn't find the answer to this question.

    Kind regards

    Zlatko

  • Mutex in the oracle stored procedure... How to get there?

    Hello

    I have the series of insert/update statements in an oracle stored procedure. The stored procedure is called composite Oracle SOA.

    The procedure works like this:

    a. download a request and checks to see if the file is already in the database. If she's here, we update, elsewhere insert.

    b. that I check for 10 tables and make the necessary inserts/updations.

    But sometimes, when I get the huge volume of transactions in the stored procedure, I see this violation of unique constraint violated due to lack of appropriate controls to ensure that no other parallel forum is trying to update the same record.

    How to do this so that no two execution of stored procedure doesn't work on the same record in the same table?

    Thank you!!

    Hello

    you might consider something like this

    create table t1(
      id number primary key,
      action varchar2(10),
      who varchar2(10)
    )
    ;
    
    declare
      p_id number           := 1;
      p_action varchar2(10) := 'Insert';
      p_who varchar2(9)     := 'Session 1';
      --
      procedure update_t1(p_id number, p_action varchar2, p_who varchar2) is
      begin
        update t1 set action = p_action, who = p_who where id = p_id;
      end;
    begin
      -- try to insert or update row for PK p_id
      merge into t1 d using (
        select
          p_id     id,
          p_action action,
          p_who    who
        from dual
      ) s on (d.id = s.id)
      when matched then
        update set d.action = 'Update', d.who = s.who
      when not matched then
        insert values (s.id, s.action, s.who)
      ;
    exception when dup_val_on_index then
      -- insert is no option, update when lock is released
      update_t1(p_id, 'Update', p_who);
    end;
    /
    
    drop table t1 purge
    ;
    

    Scenario (two sessions trying to insert/updated updated for id 1):

    session 1 inserts ("1" "insert" "Session 1") and the data is not visible to the session 2

    session 2 inserts same id but crashes because of the locking session 1

    validation of the session 1

    session 2 insert fails but who manages updating instead

    session 2 commits, values for the id 1 is now ('1' 'Update' "Session 2")

Maybe you are looking for

  • iPad 9.7 Pro WiFi connection problems - 5 GHz

    My brand new iPad 9.7 Pro is having major issues remaining connected to my home WiFi 5 GHz channels. The connection drops approximately every 30 seconds and I have to manually add the network in. Also, when he reconnection does not always have the pa

  • Satellite A305-S6898 - half black screen at startup

    I bought this laptop in early March and had to return to store due to a problem at startup when half of the screen would be black on the Windows login screen. They ordered me a new I got about 3 weeks ago and I used it for about a week before I had t

  • 1801error firmware update

    I want to know successful try tomake fdisk bootable system backs do not compete to where I can get this file andi have to know about to update firmware of the duo dual core to core 2 to max attribution thnaks competing...

  • Can't get bytes of CPU to read in LabVIEW * FTDI * Serial Communication *.

    I have trouble to get LabVIEW to display the bytes I send from a microcontroller with a FTDI chip. Specifications of communication are: baud-19200 -8-bit word length -1 stop bit -no parity -no flow control I modified the demo of the chain of read-wri

  • Product activation message Windows and I can not get a c prompt

    After that a recent installation reboot update, the following message appeared "Windows Product Activation - a problem has prevented Windows to check accurately the status of the license for this computer.  To keep your copy of Windows must be activa