O'Reilly logo

Oracle Database 11gR2 Performance Tuning Cookbook by Ciro Fiorillo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing arrays and bulk operations

In this recipe, we will see different ways to insert data in our tables and we will make some considerations about the INSERT statement's performance.

We will see how arrays can be used to speed up insert and select statements, and why it may be better to use a single statement to achieve certain goals than using a procedural approach.

How to do it...

The following steps will demonstrate the use of arrays to insert data into the tables:

  1. Connect to the SH schema:
    CONNECT sh@TESTDB/sh
    
  2. Create an empty table called MY_SALES with the same structure as the SALES table:
    CREATE TABLE sh.MY_SALES AS
    SELECT cust_id, prod_id FROM sh.sales WHERE 1=0;
    
  3. Enable timing:
    SET TIMING ON
    
  4. Create a PL/SQL block to insert the sales of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required