Doubt about the update/insertion of a Table

I have a long SQL insertion. While SQL is running, update one or more tables sources. What data will be inserted by the SQL in the target table, updated or before update?

Hello

I said regarding how widespread, this market not in what concerns the selection.

-Pavan Kumar N

Tags: Database

Similar Questions

  • doubt about the update

    Hi all

    Three statements to update, I need to run on a single table.
    Is there a way I can update instructions executed all three in a single statement?
        UPDATE xxops_forecast_extract b SET territory_id = (SELECT a.territory_id
             FROM fdev_hier_node_mv a
             WHERE a.shr_node_id = b.shr_node_id
              AND NVL(end_dt,SYSDATE) > SYSDATE) ;
        COMMIT;
    
        UPDATE xxops_forecast_extract b SET position_id = (SELECT a.row_id
            FROM s_postn a
            WHERE a.name = 'TD-'||UPPER(b.am_id))
            WHERE position_level = 7
            AND b.am_id IS NOT NULL;
        COMMIT;
      
        UPDATE xxops_forecast_extract b SET position_id = (SELECT a.row_id
            FROM s_postn a
            WHERE UPPER(a.desc_text) = UPPER(TRIM(B.POSITION_NAME)))
            WHERE position_level = 7
            AND b.am_id IS NULL;
     Below are the sample data for the tables. 
    
     xxops_forecast_extract 
     shr_node_id am_id position_name  position_id  territory_id
     2231211     Dave     (null)        (null)       (null)
     2231211     Michele  (null)        (null)       (null)
     2231211     (null)   COMM WEST 230 (null)       (null)
     2231211     (null)   COMM ISAM 110 (null)       (null)
    
     fdev_hier_node_mv
     shr_node_id territory_id 
      2231211      5694
    
    
     s_postn
     row_id    name       desc_text
     12122   TD-Dave     (null)
     12123   TD-Michele  (null)
     89381   (null)          COMM WEST 230
     89382   (null)          COMM ISAM 110
    
     Resulting table after update
    
     xxops_forecast_extract 
     shr_node_id am_id position_name  position_id  territory_id
     2231211     Dave     (null)        12122       5694
     2231211     Michele  (null)        12123       5694
     2231211     (null)   COMM WEST 230 89381       5694
     2231211     (null)   COMM ISAM 110 89382       5694
    Thank you all.

    Hello

    You can combine the statements by combining subqueries.
    No logic not apply to all the the original updates must be out of the WHERE clause and put in a CASE statement.
    The CASE statements should "update" column to itself if none of the conditions apply.

    For example, your final two statements UPDATE, that have subqueries on s_postn, both can be combined like this:

    UPDATE     xxops_forecast_extract     b
    SET     position_id =
         (
         SELECT     CASE
                   WHEN     (     b.am_id          IS NOT NULL
                        AND     UPPER (a.name)     = 'TD-' || UPPER (b.am_id)
                        )
                   OR     (     b.am_id          IS NULL
                        AND     UPPER (a.desc_text)     = UPPER (TRIM (b.position_name))
                        )
                   THEN     a.row_id
                   ELSE     b.position_id
              END
         FROM     s_postn     a
            WHERE     UPPER (a.name)          = 'TD-' || UPPER (b.am_id)
         OR     UPPER (a.desc_text)     = UPPER (TRIM (b.position_name))
         )
    ;
    

    There seems to be some mistakes in the statemnts UPDATE that you posted. For example, the last two refer to a column called position_level that does not exist in the other table.
    The above statement produces the results you want with the data you've posted.

    As you can see, the code is much harder to understand, debug and maintain.
    If the performance gain (if any) justifies the addional complexity is debatable in this case.
    I'm sure that combining all three queries would be useful.

    Consider using the MERGE: it is sometimes easier to use, even if, as in this case, you're never insert.

  • Doubt about the passage collection (Pl/SQL table) in a procedure.

    Hi all

    I have developed a package of sample with procedure 1. Here, I spent the output to a table in the collection data and I am passing the array of the collection as a parameter out.
    When I run the proc, it worked for 1 scenario, but did not work for the other. I posted two scenarios after the code.
    pkg spec:
    
    create or replace
    PACKAGE IMP_EXP_BKUP_PKG
    AS
      TYPE test10_tbl2 IS TABLE OF test10.t1%type INDEX BY BINARY_INTEGER;
      v2_test10 test10_tbl2;
      PROCEDURE manpower_list(v1 number, v2 out test10_tbl2);
    END IMP_EXP_BKUP_PKG;
    
    Pkg Body:
    
    create or replace
    PACKAGE BODY IMP_EXP_BKUP_PKG 
    AS 
    PROCEDURE manpower_list(v1 number, v2 out test10_tbl2)  AS
    BEGIN
      SELECT t1 BULK COLLECT INTO v2 FROM test10 WHERE t4 = v1; 
    END;
    END IMP_EXP_BKUP_PKG;
    Scenario 1:
    DECLARE
      v2 imp_exp_bkup_pkg.test10_tbl2;
    BEGIN
      imp_exp_bkup_pkg.manpower_list('10', v2);
      FOR i IN v2.FIRST..v2.LAST
      LOOP
        DBMS_OUTPUT.PUT_LINE(v2(i));
      END LOOP;
    END;
    Worked well.

    Scenario 2:
    DECLARE
      --v2 imp_exp_bkup_pkg.test10_tbl2;
      TYPE typ_tbl2 IS TABLE OF test10.t1%type INDEX BY BINARY_INTEGER;
      v2 typ_tbl2;
    BEGIN
      imp_exp_bkup_pkg.manpower_list('10', v2);
      FOR i IN v2.FIRST..v2.LAST
      LOOP
        DBMS_OUTPUT.PUT_LINE(v2(i));
      END LOOP;
    END;
    
    Error:
    ORA-06550: line 6, column 3:
    PLS-00306: wrong number or types of arguments in call to 'MANPOWER_LIST'
    Is not here.

    I want to just make sure that, are we supposed to use the same type that we have breeding stock in the package for the declaration of the variables?

    SamFisher wrote:

    I want to just make sure that, are we supposed to use the same type that we have breeding stock in the package for the declaration of the variables?

    Yes, you MUST use the same type definition.

    SY.

  • Ask about the creation and filling I$ table on different condition

    Hello
    I have a question about the creation and filling I$ table on a different condition. In which condition the I$ table creation? And these conditions are given below:

    (1) * source and transit area * are on the same server (that is to say target is located on another server)
    (2) * gathering and target area * are on the same server (IE source is on another server)
    (3) * source, transit area and target * are * different 3 * Server
    Source 4), area transit and target are on the same server
    Thank you

    I'm not quite clear to your question. Always try my best to erase it.

    In your all over requirement I$ table will be created.
    If the same staging as target (a database, a user) then all temporary tables are created in this user
    If the scaffolding is different from the target (a database, two users (A, B)), then all temporary tables will be created under that user A (lets consider) and the data will be inserted into the target table that is present to user B

    Staging is different from the target (two database, two users (A1, A2), architecture not recommended) if all temporary tables will be created under that user A1 (A1 of the databases) and the data will be inserted into the target table which is present in user A2 (A2 data base)

    If the source, staging, the target will be under a database then no. LKM is required, IKM is sufficient to load the data into the target. Especially for this, you can see an example given by Craig.
    http://S3.amazonaws.com/ora/ODI-Simple_SELECT_and_INSERT-interface.swf

    Thank you.

  • Need help writing an update / insert with linked tables

    I am new to ColdFusion. I am learning to write querys and creates a small application to collect information from visitors to my web site. (It's also a good way for me to learn this language) I'm having a problem and it is not only the way to use an update / insert with related tables. I don't know if I'm still gather the appropriate variables to compare them to existing DB records until his execution is the update or insert some querys. Can someone help me, show me how can I update / insert related tables and maybe tell me if I create the varibales good to the compairison? This is my code, I commented out.

    <! - creating a variable to compare with the db table - >
    < cfset userIP = ('#CGI.) REMOTE_ADDR #') >

    <! - run the query and compare the cfset cell remote_addr - >
    < name cfquery = 'userTracking' datasource = "" #APPLICATION.dataSource # "dbtype ="ODBC">"
    SELECT REMOTE_ADDR
    Of user_track
    WHERE REMOTE_ADDR = #userIP #.
    < / cfquery >

    <!-if the record exists, then run this update-->
    < cfif userTracking EQ userIP >
    < cfquery datasource = "#APPLICATION.dataSource #" >
    UPDATED user_track, trackDetail
    SET user_track. REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
    user_track. Browser = < cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
    user_track.visits = visits + 1,
    trackDetail.date = < cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
    trackDetail.path = < cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
    WHERE REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">
    < / cfquery >
    < cfelse >

    <! - if it isn't, then insert a new record-->
    < datasource = "" #APPLICATION.dataSource # cfquery "dbtype ="ODBC">"
    INSERT INTO user_track, trackDetail
    (user_track. REMOTE_ADDR, user_track.browser, user_track.visits, trackDetail.userID, trackDetail.date, trackDetail.path)
    VALUES)
    < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
    < Len (Trim (HTTP_USER_AGENT)) GT 1 cfif >
    < cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
    < / cfif >
    visits + 1,
    < cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
    < cfqueryparam value = "" #user_track.userID # "cfsqltype ="CF_SQL_VARCHAR">,"
    < cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
    < cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
    )
    < / cfquery >
    < / cfif >


    I'm close on this? This throws any errors, but it is not no longer works. It is so obviously wrong. I get a cfdump the end of my query of compairison, but once it hits the stated case, it is lost.

    Thanks for your time no matter who.

    Newbie

    You must define the variable before you can use it.  You try to use it on line 1 of your model.

  • HP Pavilion dv4-1120br: doubts about the BIOS update for my model with the operating system current instaled.

    Hello

    I have a HP Pavilion dv4-1120br, I know that this model of HP laptop is old, but I instaled the 64 bit of Windows 10 on my machine and saw that my BIOS is version F.30 and the last of them available on the site of HP F.66 has.

    The problem is that this model is not suport for Windows 10 because, as I said, is too old. Can I download and run the update of the BIOS for Windows 7 64-bit available in the Web site, or I need to downgrade my OS to Windows 7, update the BIOS and then pass it back to Windows 10?

    Thanks for the help!

    Cantarino

    Hello;

    Let me welcome you on the HP forums!

    Your second proposal is correct - as the updates to the BIOS on the HP site are specific to the OS version and if you try to run one for Win7 in Win10, it will refuse to run.

    Good luck

  • How to temporarily disable the update insert dates?

    Hello!

    DW CC on MacOS 10.11.3 2015.1

    I use "Insert date" (see: https://helpx.adobe.com/dreamweaver/using/insert-dates.html) to track the most-recent-update of content pages.  The time stamp is displayed after "Page updated:"about content. "

    I just discovered a systematic error in repeated, without reusable content in 1500 + pages. Oh!

    The solution is simple and I would like to use search and replace in DW to do the job, but I want to leave all the most recent timestamps in these pages intact, that this correction does not affect content.

    My question: how to temporarily disable the DW mechanism that updates the timestamp in the markup?

    I suspect that there is a visible JS file that implements the update, and the path to success is to temporarily replace an inert version of the same name, but before you start digging for this...

    TIA

    The file you need to disable temporarily is at the following location in Windows: C:\Program Files\Adobe\Adobe Dreamweaver CC 2015\configuration\Translators\Date.htm. He will be in a situation similar to Mac OS X in the Applications folder.

    If you use an earlier version of Dreamweaver on a PC running 64-bit Windows, see C:\Program Files (x 86).

    Date.htm contains two JavaScript functions: getTranslatorInfo() and translateMarkup() you need to temporarily replace with dummy functions.

    Know that you will be editing a program file. Needs administrator privileges to do this. As long as you know what you're doing, it should not cause problems, but you do at your own risk.

  • Doubt about the Performance

    Dear all,
    I'm running a procedure, and it should update the 8 million records.
    It uses a packaged procedure which is going on in another data base using the link of database to get certain values based on certain parameters.
    If the procedure doesn't return any data (in THE settings) then it must be inserted into a table of newspaper.
    If the procedure returns some data then it must be applied to the record in the database, like that it must update all records of 8 million

    But my procedure takes more than 14 hours to run.

    The following procedure is that I'm getting.
    It seems very simple, but I really don't understand why she's taking a lot of time.

    Guess aside.
    1 > to fill the lack of recording in the JOURNAL Table I use a PRAGMA AUTONOUMOUS_TRANSACTION procedure in the procedure itself and commit the data to see the results of the PAPER while still it runs the procedure. This will cause this procedure got COMMIT inside.

    2 > or it's because we use an external DB which is present in another data base package.

    The procedure seems very simple, but I don't know why it takes a long time.

    Appreciate any feed back.

    Thanks and greetings
    Madhu K

    create or replace procedure pr_upd_pb2_acctng_trx_gl_dist is

    cursor cur_pb2_acctng_trx_gl_dist is
    Select

    PATGD.patgd_id, patgd.company,

    PATGD.profit_center, patgd.department,

    PATGD. Account, patgd.sub_account,

    PATGD. Product, patgd.project

    of pb2_acctng_trx_gl_dist patgd;

    -where patgd_id in (4334663,227554); *


    v_r12_company varchar2 (100);
    v_r12_profit_center varchar2 (100);
    v_r12_department varchar2 (100);
    v_r12_account varchar2 (100);
    v_r12_product varchar2 (100);
    v_r12_project varchar2 (100);
    v_r12_combination_id varchar2 (100);
    v_error_message varchar2 (1000);
    number of v_patgd_id;

    procedure pr_pb2_acctng_dist_error -> THIS PROCEDURE IS USED to COMMIT for THE JOURNAL DATA TABLE. (THIS HAS GOT TO COMMIT) (WHAT IS THE REASON)
    *(*
    number of v_patgd_id

    v_company varchar2,

    v_profit_center varchar2,

    v_department varchar2,

    v_account varchar2,

    v_product varchar2,

    v_project varchar2
    *)*
    is
    pragma autonomous_transaction;
    Start
    insert into pb2_acctng_trx_gl_dist_error
    *(*
    patgd_id,

    company,

    profit_center,

    Department,

    account,

    product,

    project
    *)*
    values

    *(*
    v_patgd_id,

    v_company,

    v_profit_center,

    v_department,

    v_account,

    v_product,

    v_project

    *);*

    commit;
    end;


    Start

    run immediately 'truncate table pb2_acctng_trx_gl_dist_error;


    for rec_pb2_acctng_trx_gl_dist loop cur_pb2_acctng_trx_gl_dist
    v_patgd_id: = rec_pb2_acctng_trx_gl_dist.patgd_id;
    CGL.mis_mapping_util_pk_test1.get_code_combination@apps_r12 -> THIS IS THE DB LINK EXTERNAL PROCEDURE.
    * ('SQLGL', *)
    *'GL # », *
    NULL,
    rec_pb2_acctng_trx_gl_dist.company,
    rec_pb2_acctng_trx_gl_dist.profit_center,
    rec_pb2_acctng_trx_gl_dist. Department,
    rec_pb2_acctng_trx_gl_dist. Account,
    rec_pb2_acctng_trx_gl_dist.sub_account,
    rec_pb2_acctng_trx_gl_dist. Product,
    rec_pb2_acctng_trx_gl_dist. Project,
    v_r12_company,
    v_r12_profit_center,
    v_r12_department,
    v_r12_account,
    v_r12_product,
    v_r12_project,
    v_r12_combination_id,
    v_error_message
    *);*


    If (v_r12_company is null or v_r12_profit_center is null or v_r12_department is null
    or v_r12_account is null or v_r12_product is null or v_r12_project is null) then


    pr_pb2_acctng_dist_error (rec_pb2_acctng_trx_gl_dist.patgd_id,
    rec_pb2_acctng_trx_gl_dist.company,
    rec_pb2_acctng_trx_gl_dist.profit_center,
    rec_pb2_acctng_trx_gl_dist. Department,
    rec_pb2_acctng_trx_gl_dist. Account,
    rec_pb2_acctng_trx_gl_dist. Product,
    rec_pb2_acctng_trx_gl_dist. Project);

    on the other

    Update pb2_acctng_trx_gl_dist
    define society = v_r12_company,

    profit_center = v_r12_profit_center,
    Department = v_r12_department,
    account = v_r12_account,

    sub_account = null,
    product = v_r12_product,.
    project = v_r12_project
    where patgd_id = rec_pb2_acctng_trx_gl_dist.patgd_id;

    end if;


    end loop;

    -commit; *

    exception

    while others then

    mis_error.log_msg (0,
    NULL,
    * 'Patgd ID =' *.
    *|| v_patgd_id *.
    *|| '. SQLCODE ='*.
    *|| SQLCODE *.
    *|| '. SQLERRM ='*.
    *|| SQLERRM *.
    *);*

    end;

    Sins:

    (i) treatment of line by line - especially with a dblink.
    (II) in the course of committing
    (III) unnecessary use of an autonamous transaction.

    Looks like you need to rethink this approach and use SQL directly instead.

  • Firefox I want to find out about the updates only when the ons add that I installed currently become compatible. Is this possible?

    Firefox keeps advising me up-to-date even if a few Add ons are not compatible with the newer version. Although I don't want to be notified when an update is available, I won't update if the add ons are not compatible. Also, advising me update is useless because I will not refresh firefox when all add ons are not compatible.

    Is it possible to put the automatic notification about the availability of updates to appear only when all add ons are compatible?

    You can install this extension to see the information of current compatibility on the subject: addons page.

  • How to manage the update/insert in display with Outer Join object?

    Hello

    I have a problem in the treatment of update/insert in the original Version that contains two EOs with right outer join. The first EO values are inserted before and I want if second values EO already exists, it will update and if not a new record created.

    Error when I commit after entering values is: ' entity line with null key is not found in SecondEO. "

    What is the solution?

    Thank you

    Hello

    Make sure that your view object, you have included the key attributes of the two entity objects.

    Kind regards

    Saif Khan.

  • General question about the updates and version number

    I have a general question about versions and update.  I'm new on this and am in the deep end of learning I want.

    In vSphere web client, I see the following versions (these are exactly as the seller, he left a few months that I have screenshots in my documentation that match)

    Version - VMware ESXi, 5.1.0 1612806

    Profile - Dell (updated) ESXi - 5.1 - 799733 (A00)

    I am trying to familiarize themselves with the Update Manager and I noticed that there are a lot of patches and updates available.

    Lists of Update Manager 5 patches as "Missing" with Red x but directly above them are a list of patches with green tick indicating that "installed" - it is perhaps obvious, but im guessing 'installed' means really installed when displayed on the screen - there is an update installed, labeled "ESXI 5.1 all the update 2-' would be able to tell that it has been installed by the details of profile/version above?

    I don't think it's a big deal at this stage, but if I install all missing patches and then the details of the version/profile change in summary screen?

    I hope this makes sense.

    Thank you

    This article allows to correlate the updated version: products VMware correlating build numbers to update levels (1014508)

  • I have a doubt about the file .folio and publications

    Hello, I m new here.

    I want to start working with DPS, but I have a doubt about which version to buy.

    At the moment I have one customer just wants to publish a magazine, but my intention is to have more customers and publish more magazines.

    If I buy the unique edition of DPS, I read that I can publish a single file .folio. What it means? Each folio file represents a publication?

    Please, I need help to understand this before you purchase the software.

    Thank you very much

    Paul

    Here's a quick blog I wrote to compare the simple edition and

    multifolio apps:

    http://boblevine.us/Digital-Publishing-Suite-101-single-Edition-vs-multi-Folio-apps/

    Bob

  • Questions about the update of an application in the app store

    I am a member of creative cloud working with simple editing DPS. My app was approved by Apple and is in the store. But, of course, there is a typing error. What should I know about the submission of an updated version. Should have a new 1.1 version number to say? Can I use the same mobile both provision and development 12 certificates? Is the review ordering process more when it's an update?

    Thank you

    Chuck

    Hi Chuck,

    Subscribe to Adobe Creative cloud can revise their applications (and submit their applications reconstructed at Apple) as long as they subscribe to creative cloud. When you change your application, use the same ID App and distribution provisioning profile to create the new custom Viewer. In DPS App Builder, select the existing application that you have created and click on modify. Specify the latest version of the app, if you want and follow the prompts to create a new app download and test the development agenda. In iTunes Connect, click on manage your Applications, click the application that you want to update, and then click Add Version. Follow the prompts and then use Application Loader to download the .zip file.

    Concerning

    PEREADEL

  • Question about the update

    So when I bought my phone it was already updated to Lollipop (5.1) and missing only the updated jour.264. When I updated the phone I got only 47% battery (some say I shoukd have more than 80%) and the plant does not reset it.

    Bad conduct? Thank you!

    Nothing, keep an eye on the features of the software. And enjoy your device.

  • Question about the update of the ICS

    Hello

    I've updated my bow to android 4.0.4 yesterday, and his great performance, I just want to ask when I updated it I did not remove my SIM and SD card, after updating all my contacts where always there and my installed is still installed, is this ok? I want to say that I expected that my installed applications will be

    deleted and my contacts, my messages and call logs too but, after the update, nothing has been deleted and the phone works to 4.0.4 android os, pls help.

    P.S. the updated software was great, my phone is running smooth, thanks Sony,

    Yes, its normal, when the update using SUS you have two options here, update your phone without deleting your files or factory resetting your phone then install the update, or if you download the OTA update no file will be deleted. If you have problems you can reinstall the update or data factory reset your phone.

Maybe you are looking for