Need to check delays in update of 1000 lines using the PL/SQL procedure.

Hi all

I'm new to PL/SQL. I need your help to build a procedure that executes the following statement and follows the time of update of 1000 rows. This is to check the performance of the database. I need to print the timestamp of start before the update and end timestamp after update. I need to do for the 1000 lines. The statement that will be used in the procedure is:

SELECT

'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').

', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').

', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').

"', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').

"', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | NVL (TO_CHAR (START_TS), 'NULL').

', END_TS =' | NVL (TO_CHAR (END_TS), 'NULL') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').

"', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').

', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').

', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | NVL (TO_CHAR (LAST_UPD), 'NULL') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').

"', W_INSERT_DT = ' | NVL (TO_CHAR (W_INSERT_DT), 'NULL') |', W_UPDATE_DT = ' | NVL (TO_CHAR (W_UPDATE_DT), 'NULL').

', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |

NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; »  OF XXAFL_MON_FACTS_F;

The above query creates instructions of update that must be executed 1000 times and the time required to update the 1000 lines should be followed.

Thanks in advance!

Code horribly wrong!

Why this approach?

Dynamic SQL is almost NEVER needed in PL/SQL. And if you think it's necessary and taking into account what is displayed as being problems here, you have a 99% chance of being wrong.

This 1% where dynamic SQL is necessary, he will WITH bind variables to create shareable SQL, decrease memory requests, decrease the likelihood of a fragmented shared reel and decrease the burning CPU cycles on hard analysis.

An example below. Your approach is the 1st. One that is slower than the correct approach to 37 (x_!) ...

SQL> create table t ( n number );

Table created.

SQL>
SQL> var ITERATIONS number;
SQL> exec :ITERATIONS := 100000;

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> TIMING START "INSERTs using Hard Parsing"
SQL> declare
  2          i      integer;
  3  begin
  4          for i in 1..:ITERATIONS
  5          loop
  6                  execute immediate 'insert into t values ('||i||')';
  7          end loop;
  8          commit;
  9  end;
10  /

PL/SQL procedure successfully completed.

SQL> TIMING SHOW
timing for: INSERTs using Hard Parsing
Elapsed: 00:02:00.33
SQL>
SQL> TIMING START "INSERTs using Soft Parsing"
SQL> declare
  2          i      integer;
  3  begin
  4          for i in 1..:ITERATIONS
  5          loop
  6                  execute immediate 'insert into t values ( :1 )' using i;
  7          end loop;
  8          commit;
  9  end;
10  /

PL/SQL procedure successfully completed.

SQL> TIMING SHOW
timing for: INSERTs using Soft Parsing
Elapsed: 00:00:06.06
SQL> drop table t;

Table dropped.

SQL> create table t( n number );

Table created.

SQL>
SQL>
SQL> TIMING START "INSERTs using a single parse and repeatable statement handle "
SQL> declare
  2          i      integer;
  3  begin
  4          for i in 1..:ITERATIONS
  5          loop
  6                  insert into t values ( i );
  7          end loop;
  8          commit;
  9  end;
10  /

PL/SQL procedure successfully completed.

SQL> TIMING SHOW
timing for: INSERTs using a single parse and repeatable statement handle
Elapsed: 00:00:04.81
SQL>

Tags: Database

Similar Questions

  • Update of several lines using the join condition

    Hi all

    CREATE OR REPLACE
    PROCEDURE update_t
    IS

    BEGIN
    SheikYerbouti IN (SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME FROM hr.employees)
    LOOP
    UPDATE
    HR.employees1
    SET
    FOCA =)
    Select concat (FIRST_NAME, LAST_NAME) in the hr.employees where SheikYerbouti. EMPLOYEE_ID = 197);
    END LOOP;
    END update_t;
    /

    I'm trying to update column Foca Employees1 table. When I run this procedure, I get the error

    Error report:
    ORA-01427: einreihig subquery returns multiple rows
    ORA-06512: at "SYSTEM. UPDATE_T", line 13
    ORA-06512: at line 1
    01427 00000 - "einreihig subquery returns several lines.

    Please let me know a solution for this.

    Thank you
    Mathon

    Hello Mathieu,
    in your internal SQL result set is not limited to just one line.
    Try this

    UPDATE hr.employees1 SET
    FIRST_LAST= (select concat(FIRST_NAME,LAST_NAME) from hr.employees where emp_rec.EMPLOYEE_ID=hr.employees.employee_id);
    

    Your version had no restrictions on selected lines of hr.employees. You gave a where condition clause that is not related to the query.

    The best solution for your problem is to avoid completely any PL/SQL loop. You can try something like this:

    update
       (select
           e1.first_last,
           e.first_name,
           e.last_name
        from
           hr.employees1 e1,
           hr.employees e
        where
           e1.employee_id=e.employee_id) set
       first_last=first_name||last_name;
    

    But beware, the updates on the joints work only under certain restrictions. The key of the table to be updated must be the join key. (key preserved is the word to look for).

    Hope that helps,
    dhalek

  • I'm trying to update my applications by using the desktop creative cloud application. I see not all the apps in the app tab, the wheel just spins in circles and nothing happens. Someone at - it ideas? I tried to uninstall the application and reinstall it

    Hello

    I'm trying to update my applications by using the desktop creative cloud application. I see not all the apps in the app tab, the wheel just spins in circles and nothing happens. Someone at - it ideas? I tried to uninstall office and reinstall, but it still has the same problem.

    See you soon

    Rachel

    Hi Rachel,

    You can follow the article: App does not open. Wheel of progress turn continuously to get your landline number.

    Let us know if the problem persists or not.

    Kind regards

    Yann Arora

  • Failed to check for an update. -Failed to start the windows Security Center service

    Well, as I want to check for windows update, it says that "Windows update cannot currently check for updates, because the service is not runing.» You may have to restart your computer. I alrdy restart my laptop several times that the answer is always the same. I think that this problem related to my service center of windows security. for some reason I can't why it may not be on. can someone help with the solution m.e? Thank you

    azbondz,

    In addition to the information requested, try these troubleshooting of beginning steps and let us know the results from them.

    Clean boot your PC, and then run Windows Update.

    Reset the Windows Update components

    Perform operations of KB883825

    Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Updates using the single SQL Update statement.

    Hi guys,.

    I got an interview... and was not able to answer a question.

    In view of the table emp... need to update the salary with the following requirement by using an SQL statement.

    1 update salary + 1000 for employees who receive pay between 500 and 1000
    2 update salary + 500 for employees who receive wages between 1001 and 1500

    The two above the requirement should be made using only a SQL update statement... can someone tell me how to do?
    update emp
      set salary   = case when salary between 500 and 1000
                                then salary + 1000
                                when salary between 1001 and 1500
                                then salary + 500
                          end;
    

    Concerning
    Arun

  • BlackBerry software update failed Smartphone, cannot use the phone, but can attach to the computer access to the Internet.

    How to fix the phone. Software of office says "cannot communicate with the device.

    Hi and welcome to the Forums!

    Good job on the recovery! But all is not lost for your data. If you did the update via your PC, then in the early stages of the process should have been a backup of your data (assuming you do not defeat this feature). If you're on a PC, then look for in your entire hard drive to a file with the extension of the IPD (*.) IPD)... check the date and time of the results... created more recently is your best candidate and if all goes well, it was created at the time you did the update. Use this procedure to restore this file:

    • KB10339 How to use BlackBerry Desktop Manager to restore the data to a BlackBerry smartphone from a backup file

    If you use a MAC, I don't know how he does things, but maybe this KB is useful:

    • KB18776 Back up and restore BlackBerry smartphone data on a Mac using BlackBerry Desktop Software 2.0

    If you performed the update OTA or otherwise circumvented the backup data, then you are indeed no chance.

    Good luck!

  • Have an Acer which need a reinstall, but I don't want to use the recovery partition.

    Basically, Acer for a reason any installed this copy of windows with a buttload of bloatware, used FAT32 instead of NTFS, and added a recovery partition which literally takes half of the hard drive. No physical reinstall disk, of course.

    What I am wanting to do is to install a new copy of the same version of Windows from a vanilla install disc, but I did not posses disc. My questions are:

    1 - ordinary copy, non - OEM activate again using the old product key?

    2. is it legal to download an .iso of the Setup from somewhere disk to install it? (If not, I might be able to locate a friend with a copy...?)

    Anti-malware programs are a good tool to use, but they are not 100%.

    About file system conversion, see these two pages:

    http://www.NTFS.com/quest3.htm

    http://www.aumha.org/win5/a/ntfscvt.php

    Since you already have a safe way to reinstall XP, I just do it. No need to download the .iso that could end does not properly.

  • Need help to print a logo on several pages using the ^ graph of order

    Hello.

    I'm using Adobe Output Designer 5.7 (formerly Jet Forms).

    Our logo was incorporated originally in about 100 forms of Jet (*.) Files of the IFD).    There was the ability to print multiple logos of the same *. File of the IFD.

    I found that I could use the ^ graph command.   But the logo only print on the first page.     In the. * IFD file it is 60 pages/subforms.   Page 1 contains the data header and footer of page 1.   Page 2 contains the data header and footer that are used on Pages 2 - N.

    I'm passing to JetForms SAP data.

    I tried several options, but it is impossible that it works correctly.

    The full path and the name of the logo is stored in the variable & T_LOGO_FILENAME &.

    Here's what I tried to do and results information.

    Attempt 1)

    ^ COMPANY_LOGO FIELD

    ↑ GRAPH & T_LOGO_FILENAME &

    This displays the logo on the first page.    It print the logo where the COMPANY_LOGO field appears in JetForms.

    The first page seems perfect.

    The problem is that no logo appears on page 2.

    Attempt 2)

    GLOBAL COMPANY_LOGO ↑

    ↑ GRAPH & T_LOGO_FILENAME &

    Logo print in the middle of Page 1.   It does not print when the COMPANY_LOGO is located in JetForms.

    No logo prints on Page 2.

    Attempt 3)

    ↑ GRAPH

    & T_LOGO_FILENAME &

    This displays the name of the file in the middle of the first page.

    Attempt 4)

    GLOBAL COMPANY_LOGO ↑

    Michelle tests

    The text "Michelle Testing" appear on Page 1 and Page 2 in the correct position on the screen.   It prints where the COMPANY_LOGO field is in the form of Jet.

    We will need to add or change logos periodically.    We are now looking for dynamically pass the name of the file to JetForms, so that we have no need to edit and compile 100 *. Files in IDF every time a new logo is added.

    Any suggestions or recommendations?

    Thank you
    Michelle

    SOLUTION

    I need to set the type to "Graphics" in the form of Jet.  (The type was originally 'Text').

    The code is SAP looks like:

    ^ COMPANY_LOGO FIELD

    & T_LOGO_FILENAME &

    The result is perfect now.  Logo print in the right position on each page.

  • Update a record questioned using the parameter

    Hi all

    Have someone to help me to update an interviewed record of forms. It's like that when I use ID to search for the details, I want to update the record you are searching.

    Arif

    Hi Arif,
    Here you're doing something complicated with you.

    1 UCID_PARAM and USERCREATION are 2 revenge in the same form
    2 UCID_PARAM contain column UCID which is the primary key of the table usercreation. I used this block to pass

    The blockk UCID_PARAM here is the database block and why you must pass the value as a parameter because as you say it is primary key and foreign key in the block. Then why do you use search mechanism Assembly. I mean just create relationship between UCID_PARAM and USERCREATION block or if he joins then just use the method ENTER_QUERY and EXECUTE_QUERY. I understand because if you enter a value in the UCID_PARAM block and goes to the block of detail and do EXECUTE_QUERY by selecting a WHERE CLAUSE.

    So, what's going to happen here. System takes into account that you are inserting record in UCID_PARAM. So, there is a field that is not null, then the error is coming.

    Just use the default behavior of your forms. Or if you really want to use this method. Next, create a block of data non-base to pass the parameter. Do not use UCID_PARAM as the database block.

    And one more thing, I noticed in your this clause

    set_block_property ('USERCREATION', onetime_where, 'UCID =' |) ': UCID_PARAM. UCID');

    It should be

    set_block_property('USERCREATION',onetime_where,'UCID='||:FORM_FIELD_NAME);

    I hope it is clear now.

    -Clément

  • Satellite L25 - after that Windows update is unable to use the Wi - Fi button

    I have a S-1193 Satellite L25, caught a virus, and after a windows update, cannot use wi - fi on the front button.

    What I have to do is disable the adapter, turn it on, then re-boot.
    If I turned off the computer, I di everything again.

    This will make the button work? Or is there a setting that is always on?

    Hello

    > after a windows update, cannot use wi - fi on the front button
    Do you mean the button that launches Internet Explorer?

    According to your message the laptop doesn't connect to the WLan automatically and you will need to connect it manual to get the job of WLan.
    Is this right?

    I put t know how you have connected the laptop to your router, but usually, if you own Windows WLan zero configuration then you should make sure that the parameters to a called + connect when this network is in range. +

    Welcome them

  • I don't get updates to windows, I used the system and clicked on update

    I clicked on the automatic updates - have not received any...

    You must be level SP3 before you use Windows update.

    http://support.Microsoft.com/kb/2497281
    You may be unable to access the site Web Windows Update in Windows XP, Windows 2000 or Windows Server 2003

    To determine which service pack is currently installed on your computer, follow these steps:

    1. Click Startand then click run.
    2. Copy and paste, or type the following command, and then click OK:

    winver

    A dialog box displays the version of Windows and the service pack that is currently installed on your computer.

    If you haven't already done so, you will need to install the SP2 and SP3 (SP1 note no longer exists).

    How to obtain the latest Windows XP service pack
    http://support.Microsoft.com/kb/322389

    SP2 - http://www.microsoft.com/en-us/download/details.aspx?id=28 (for single PCs too)

    For Windows XP Service Pack 2 installation procedure
    http://support.Microsoft.com/kb/875364

    Steps to take before you install Windows XP Service Pack 3
    http://support.Microsoft.com/kb/950717

    It is stated in "How to obtain the latest service pack XP" is.

    If you have problems obtaining the service pack from Windows Update, you can download the package of standalone update from the Download Center. This page will say that this installation package is intended for it professionals and developers. However, you can download this file safely. The following file is available for download from the Microsoft Download Center:

    Download the Windows XP Service Pack 3 package now

  • How to check the arhice mode is on or not according to the pl/sql procedure

    Hello

    I'm trying to figure out how to check the mode archive inside begin end block. Basically, I'm developing a procedure that returns in mode archive.

    I know that the following command returns the status of fashion archive but I can't do the job inside the begin end block.

    "list of archive logs.

    I'll be appricated if you show me how to call the above command inside begin end block.

    Kind regards.

    Hello

    If you want to see archive log mode is activated, you can simply check V$ database.

    select log_mode from v$database
    

    That is what you want, or is there something more, you need?

    David

  • Problem updating my state machine, using the emg signal

    Hello

    I have problems with my code. My entry is an EMG signal that I gather from three different electrodes using usb 6008. In the program, I divide the signals and display them in a chart that is unique. What I want now is to read the signal, and if a signal passes a threshold I want an LED lights. This must remain lit until there is another signal that passes the threshold.

    To put it simply: "large enough signal--> lamp on--> stay informed--> enough large signal--> lamp--> stay off the coast and then start again."

    I tried a few different approaches, but I decided using a state machine. Now, the problem is that when the signal to enter the state machine the program crashes. I think it's because the table that I use to convert the signals does not update when I get my state machine, so the signal stops to come. But how to get around this problem? It is even possible to code what I want?

    I have attached the code. All the tips are welcome, I have been struggling with this for some time now.

    Thank you

    jenmich

    The problem is internal while the loop is run until the stop condition is true, but he never does a new Boolean entry. So that it remains for always in the same State. Remove the inner loop and put the shift register on the outer loop instead.

    You must also use a daqmx configures the element, and then set the properties of daq. The read.vi can be set to read a number of samples of each iteration.

    Also: you can expand the table to index for several items of output. If you want that element number 0, 1, and 2, you have yet to wire the index entries

  • My Windows Update does not work. When I try to access it, a box flashes on my screen, but I can't access it. I tried to use Windows Update via on line, and the same thing happens. Help!

    Too bad.  I managed to do the work.  I will now reboot and see if it solved the problem.

    OK, I restarted.  Always impossible to get Windows Update to happen on the screen.

  • I need help to be an option for me to use the filters Gallery. It won't let me click on it.

    I am doing a project for my digital art classes and I'm trying to use artistic filters from the filter Gallery. When I go to the filters tab, the Gallery of filters is gray and it won't let me click on it to access these filters.

    Hi Ericaaervin,

    Please of course color mode is RGB, you can check it out by clicking on the image and choose the mode. Also, make sure that it is the 8-bit.

    Here is the screenshot for your reference,

    Thank you

Maybe you are looking for

  • Merge Skype Facebook account

    I created a Skype account. I tried a disconnect then you connect using my Facebook account. According to the online instructions, I should have been asked to merge my Facebook account with the Skype account... but I did not receive this prompt. How c

  • circle cannot be moved or resized

    I use iPhotos v1.3 on an iMac OS El Capitan v10.11.02 running. iPhotos worked a lot when suddenly the circle indicating the frozen face - both when the circle is generated by the Mac, or I add a circle from the front, the circle cannot be moved or re

  • Add columns to the table

    I'm having a bit of a basic problem here... I start with a waveform D 1 from a request of data acquisition, which contains ~ 22 columns of data corresponding to the different measures. I wanted to take the first 20 columns of data and add the "column

  • IE8

    is there a way not to install or hide ie8, because when I try to use my online banking I can't enter my account and I'm not sure if I will have problems with other sites that I pay bills online

  • Blue screen on Windows Vista

    OK, now here is the problem. My laptop dell Inspiron computer running windows vista will be randomly blue screen of anywhere between 15 minutes of use to 6 hours of use. It is very important for me to have my laptop works well, I reinstalled my OS an