`

Oracle FORALL_Example

阅读更多
CREATE TABLE blktest (num NUMBER( 20), name varchar2( 50));

CREATE OR REPLACE PROCEDURE bulktest IS
    TYPE numtab IS TABLE OF NUMBER (20) INDEX BY BINARY_INTEGER;

    TYPE nametab IS TABLE OF VARCHAR2 (50) INDEX BY BINARY_INTEGER;
    pnums  numtab;
    pnames nametab;
    t1     NUMBER;
    t2     NUMBER;
    t3     NUMBER;
BEGIN
    FOR j IN 1 .. 1000000
    LOOP
        pnums(j) := j;
        pnames(j) := 'Seq No. ' || to_char(j);
    END LOOP ;

    SELECT dbms_utility.get_time
    INTO   t1
    FROM   dual;

    FOR i IN 1 .. 1000000
    LOOP
        INSERT INTO blktest
        VALUES
            (pnums(i)
            ,pnames(i));
    END LOOP ;

    SELECT dbms_utility.get_time
    INTO   t2
    FROM   dual;

    FORALL i IN 1 .. 1000000
        INSERT INTO blktest

        VALUES
            (pnums(i)
            ,pnames(i));

    SELECT dbms_utility.get_time
    INTO   t3
    FROM   dual;
    dbms_output.put_line( 'Execution Time (hsecs)');
    dbms_output.put_line( '---------------------');
    dbms_output.put_line( 'FOR loop: ' || to_char(t2 - t1));
    dbms_output.put_line( 'FORALL:   ' || to_char(t3 - t2));
END;

Execution Time (hsecs)
---------------------
FOR loop: 5747
FORALL:   90
  

分享到:
评论

相关推荐

    最全的oracle常用命令大全.txt

    ORACLE常用命令 一、ORACLE的启动和关闭 1、在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a、启动ORACLE系统 oracle>svrmgrl SVRMGR>connect internal SVRMGR>startup ...

    Oracle PL/SQL programming(5th Edition)

    In explaining number conversions, for example, he explores Oracle’s different ways of formatting numbers, then details the behavior of the to_number function under different conditions (with and ...

    Oracle Core Essential Internals

    unreadable Consider for example the simple question: How does Oracle do a logical I O then take a look at structure x$kcbsw which is a list of all the functions that Oracle might call to visit a ...

    Oracle+10G+-+Plsql+User's+Guide

    The FORALL statement can handle associate arrays and nested tables with deleted elements. You can now use this performance construct in more situations than before, and avoid the need to copy elements...

    oracle asm rac

    Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. 创建grid目录结构...

    Expert Oracle Database Architecture 2nd Edition

    It’s good to have an idea of how B-tree indexes (for example) actually work so that we can understand their strengths and weaknesses. Then we can move on to the idea of function-based indexes—...

    Oracle提高与精通

    That is the Oracle code !! You can use it improve your ability!! You know if you don't use the DATABASE and The Commnad that you...All example in the RAR File!! Hope you can use it and it can help you!!!

    oracle truncate恢复

    4 4 4 D:\ORACLE\ORADATA\XJ\EXAMPLE01.DBF 4096 5 5 5 D:\ORACLE\ORADATA\XJ\INDX01.DBF 4096 6 6 6 D:\ORACLE\ORADATA\XJ\ODM01.DBF 4096 7 7 7 D:\ORACLE\ORADATA\XJ\TOOLS03.DBF 4096 7 8 8 D:\ORACLE\...

    Oracle sqldeveloper without jdk (win+linux)

    - The script to which the character belongs is supported by the JRE installation on which SQL Developer is running � for example, appropriate fonts are available � and - The script does not ...

    php.ini-development

    You can redirect all of the output of your scripts to a function. For ; example, if you set output_handler to "mb_output_handler", character ; encoding will be transparently converted to the ...

    advanced oracle pl-sql

    Chapter 5, PL/Vision Package Specifications provides a brief summary of all of the specifications for the PL/Vision packages, and is marked with a thumb-tab for quick reference. Part III: Building ...

    MySQL and JSON A Practical Programming Guide 2018

    Written by a MySQL Community Manager for Oracle, MySQL and JSON: A Practical Programming Guide shows how to quickly get started using JSON with MySQL and clearly explains the latest tools and ...

    SQL Assistant v5.0

    Preset code formatting rule added for Oracle VARRAY. Preset code formatting rule added for DEFAULT VALUES in INSERT/UPDATE statements in Transact-SQL. Database name and schema name completion is now...

    OCP Upgrade 1Z0-060 Exam guide 1st Edition

    All of the information in this book has been handpicked to help you study for the Oracle 12c upgrade exam. Each chapter has been written with the objective of helping you pass this exam with ease. ...

    PLSQL.Developer v11.0.0.1762 主程序+ v10中文包+keygen

    Support has been added for Oracle12c extended strings (> 4000 bytes) The align button has a new Hide editor option to show only the result set The align button has a new Window width option to resize ...

    Progress/OpenEdge语言手册

    You can consider a language element as supported for all interfaces, on all operating systems, and for SpeedScript unless otherwise indicated in the language element description. The platform ...

    core_servlets_and_javaserver_pages_advanced_technologies_volume_2_2nd_edition

    Suppose your company wants to sell products online. You have a database that gives the price and inventory status of each item. However, your database doesn’t speak ...Web browsers need.... For example,

    PLSQL.Developer(X32) v12.0.1.1814主程序+ v11中文包+keygen

    Support has been added for Oracle12c read privileges for tables and views. Scripts generated by Export User Objects and Export Tables now have user-defined initialization and finalization. These files...

    端口查看工具

    window), for example: include:process:327 * Version 2.07: o Fixed the flickering on automatic refresh. * Version 2.06: o Fixed issue: The properties dialog-box and other windows opened in the ...

    PLSQL.Developer(X64) v12.0.1.1814 主程序+ v11中文包+keygen

    Support has been added for Oracle12c read privileges for tables and views. Scripts generated by Export User Objects and Export Tables now have user-defined initialization and finalization. These files...

Global site tag (gtag.js) - Google Analytics