Records 5 - 35 · Specifying Parameter Modes for Bind Variables in Dynamic SQL Strings Shows how PL/SQL supports the SQL commands, functions, and operators for PL/SQL's exception handling is different from the manual checking
Previous PDF | Next PDF |
[PDF] Mastering Oracle PL/SQL: Practical Solutions
developers to present dynamic Web pages from directly within the data- base SQL*Plus provides many useful options and commands that we'll make frequent In fact, many a training manual, book, and even the standard Oracle documen-
[PDF] Oracle Database PL/SQL Users Guide and Reference - Oracle Help
Records 5 - 35 · Specifying Parameter Modes for Bind Variables in Dynamic SQL Strings Shows how PL/SQL supports the SQL commands, functions, and operators for PL/SQL's exception handling is different from the manual checking
[PDF] Oracle Database PL/SQL Language Reference - Oracle Help Center
29 mar 2010 · When Explicit Cursor Queries Need Column Aliases Dynamic SQL Statement is Not Anonymous Block or CALL Statement 7-
[PDF] Oracle10g Advanced PL/SQL Programming - ITCourseware
14 août 2006 · Oracle 10g Advanced PL/SQL Programming Using DBMS_SQL for Queries that has either a hard or soft shell top, and manual or power
[PDF] Pl/sql tutorial w3schools pdf - Squarespace
The HTML5 certificate documents your knowledge of advanced HTML5 Tutorial Oracle PL/SQL Variable Identifiers Tutorial with Examples Tutorial Oracle
[PDF] Preview PL/SQL Tutorial (PDF Version) - Tutorialspoint
This tutorial will give you great understanding on PL/SQL to proceed with Oracle database and other advanced RDBMS concepts Audience This tutorial is
[PDF] TOP TWENTY PL/SQL TIPS AND TECHNIQUES
Since PL/SQL Version 2 was first released, for example, Oracle Corporation has added dynamic SQL, RDBMS-based job scheduling, file I/O, and cursor variables
[PDF] Easy Oracle PL/SQL Programming - Caribbean Environment
Right here, we have countless books Easy Oracle PL/SQL Programming: Get Started Fast with Working PL/SQL Code Examples and collections to check The basics of PL/SQL are introduced using multiple triggers Extend functionality using dynamic SQL statements Understand Working PL/SQL Code Examples pdf
[PDF] An Training Guide PL/SQL for Beginners - Toolboxcom
Exceptions for an Oracle Error Code 100 There are some more advanced operators available SQL*Plus is by entering PL/SQL commands directly into the
[PDF] oracle amr support
[PDF] oracle apex 19 manual
[PDF] oracle apex 19.1 architecture
[PDF] oracle apex 19.1 tutorial
[PDF] oracle apex 19.1 tutorial for beginners
[PDF] oracle apex 19.1 tutorial pdf
[PDF] oracle apex 19.2 download
[PDF] oracle apex 19.2 installation
[PDF] oracle apex 19.2 new features
[PDF] oracle apex 19.2 popup lov
[PDF] oracle apex 5
[PDF] oracle apex components
[PDF] oracle apex documentation
[PDF] oracle apex download file button
Oracle® Database
PL/SQL User's Guide and Reference
10g Release 2 (10.2)
B14261-01
June 2005
Oracle Database PL/SQL User's Guide and Reference 10g Release 2 (10.2)B14261-01
Copyright © 1996, 2005, Oracle. All rights reserved.Contributors: Shashaanka Agrawal, Cailein Barclay, Eric Belden, Dmitri Bronnikov, Sharon Castledine,
Thomas Chang, Ravindra Dani, Chandrasekharan Iyer, Susan Kotsovolos, Neil Le, Warren Li, Bryn Llewellyn, Valarie Moore, Chris Racicot, Murali Vemulapati, John Russell, Guhan Viswanathan, Minghui YangThe Programs (which include both the software and documentation) contain proprietary information; they
are provided under a license agreement containing restrictions on use and disclosure and are also protected
by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly,
or decompilation of the Programs, except to the extent required to obtain interoperability with other
independently created software or as specified by law, is prohibited.The information contained in this document is subject to change without notice. If you find any problems in
the documentation, please report them to us in writing. This document is not warranted to be error-free.
Except as may be expressly permitted in your license agreement for these Programs, no part of thesePrograms may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose.If the Programs are delivered to the United States Government or anyone licensing or using the Programs on
behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical datadelivered to U.S. Government customers are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As
such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation
and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license
agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial
Computer Software - Restricted Rights (June 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City,
CA 94065
The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently
dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup,
redundancy and other measures to ensure the safe use of such applications if the Programs are used for such
purposes, and we disclaim liability for any damages caused by such use of the Programs. Oracle, JD Edwards, PeopleSoft, and Retek are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. The Programs may provide links to Web sites and access to content, products, and services from thirdparties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites.
You bear all risks associated with the use of such content. If you choose to purchase any products or services
from a third party, the relationship is directly between you and the third party. Oracle is not responsible for:
(a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the
third party, including delivery of products or services and warranty obligations related to purchased
products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from
dealing with any third party. iiiContents
Send Us Your Comments ..................................................................................................................... xvii
Preface............................................................................................................................................................... xix
Audience..................................................................................................................................................... xix
Documentation Accessibility................................................................................................................... xix
Structure ..................................................................................................................................................... xx
PL/SQL Sample Programs....................................................................................................................... xxi
Related Documents.................................................................................................................................. xxii
Conventions .............................................................................................................................................. xxii
What's New in PL/SQL?......................................................................................................................... xxv
New Features in PL/SQL for Oracle Database 10g Release 2 (10.2)................................................ xxv
New Features in PL/SQL for Oracle Database 10g Release 1 (10.1)................................................ xxvi
1 Overview of PL/SQL
Advantages of PL/SQL............................................................................................................................ 1-1
Tight Integration with SQL............................................................................................................... 1-2
Better Performance............................................................................................................................. 1-2
Higher Productivity........................................................................................................................... 1-3
Full Portability.................................................................................................................................... 1-3
Tight Security...................................................................................................................................... 1-3
Access to Pre-defined Packages....................................................................................................... 1-4
Support for Object-Oriented Programming................................................................................... 1-4
Support for Developing Web Applications and Pages................................................................. 1-4
Understanding the Main Features of PL/SQL.................................................................................... 1-4
Understanding PL/SQL Block Structure........................................................................................ 1-4
Understanding PL/SQL Variables and Constants........................................................................ 1-5
Declaring Variables..................................................................................................................... 1-5
Assigning Values to a Variable................................................................................................. 1-6
Bind Variables ............................................................................................................................. 1-7
Declaring Constants.................................................................................................................... 1-7
Processing Queries with PL/SQL.................................................................................................... 1-8
Declaring PL/SQL Subprograms..................................................................................................... 1-8
Declaring Datatypes for PL/SQL Variables................................................................................... 1-8
%TYPE.......................................................................................................................................... 1-8
iv%ROWTYPE ................................................................................................................................ 1-9
Understanding PL/SQL Control Structures.................................................................................. 1-9
Conditional Control................................................................................................................. 1-10
Iterative Control....................................................................................................................... 1-10
Sequential Control ................................................................................................................... 1-12
Understanding Conditional Compilation ................................................................................... 1-12
Writing Reusable PL/SQL Code................................................................................................... 1-13
Subprograms: Procedures and Functions ............................................................................ 1-13
Packages: APIs Written in PL/SQL....................................................................................... 1-13
Inputting and Outputting Data with PL/SQL............................................................................ 1-15
Understanding PL/SQL Data Abstraction.................................................................................. 1-16
Cursors ...................................................................................................................................... 1-16
Collections................................................................................................................................. 1-16
Records...................................................................................................................................... 1-16
Object Types ............................................................................................................................. 1-17
Understanding PL/SQL Error Handling .................................................................................... 1-18
PL/SQL Architecture............................................................................................................................. 1-18
In the Oracle Database Server....................................................................................................... 1-19
Anonymous Blocks.................................................................................................................. 1-19
Stored Subprograms................................................................................................................ 1-19
Database Triggers .................................................................................................................... 1-20
In Oracle Tools................................................................................................................................. 1-21
2 Fundamentals of the PL/SQL Language
Character Sets and Lexical Units........................................................................................................... 2-1
Delimiters............................................................................................................................................ 2-2
Identifiers ............................................................................................................................................ 2-3
Reserved Words.......................................................................................................................... 2-4
Predefined Identifiers................................................................................................................. 2-4
Quoted Identifiers....................................................................................................................... 2-4
Literals ................................................................................................................................................. 2-4
Numeric Literals.......................................................................................................................... 2-5
Character Literals........................................................................................................................ 2-6
String Literals............................................................................................................................... 2-6
BOOLEAN Literals..................................................................................................................... 2-7
Datetime Literals......................................................................................................................... 2-7
Comments ........................................................................................................................................... 2-7
Single-Line Comments............................................................................................................... 2-7
Multi-line Comments ................................................................................................................. 2-8
Restrictions on Comments......................................................................................................... 2-8
Declarations............................................................................................................................................... 2-8
Constants............................................................................................................................................. 2-9
Using DEFAULT................................................................................................................................ 2-9
Using NOT NULL.............................................................................................................................. 2-9
Using the %TYPE Attribute........................................................................................................... 2-10
Using the %ROWTYPE Attribute................................................................................................. 2-11
Aggregate Assignment............................................................................................................ 2-12
vUsing Aliases............................................................................................................................ 2-12
Restrictions on Declarations.......................................................................................................... 2-13
PL/SQL Naming Conventions............................................................................................................ 2-13
Scope and Visibility of PL/SQL Identifiers..................................................................................... 2-15
Assigning Values to Variables............................................................................................................ 2-18
Assigning BOOLEAN Values........................................................................................................ 2-19
Assigning a SQL Query Result to a PL/SQL Variable.............................................................. 2-19
PL/SQL Expressions and Comparisons............................................................................................. 2-19
Logical Operators............................................................................................................................ 2-20
Order of Evaluation................................................................................................................. 2-21
Short-Circuit Evaluation......................................................................................................... 2-21
Comparison Operators............................................................................................................ 2-22
Relational Operators................................................................................................................ 2-22
IS NULL Operator.................................................................................................................... 2-23
LIKE Operator.......................................................................................................................... 2-23
BETWEEN Operator................................................................................................................ 2-23
IN Operator............................................................................................................................... 2-23
Concatenation Operator.......................................................................................................... 2-23
BOOLEAN Expressions ................................................................................................................. 2-24
BOOLEAN Arithmetic Expressions...................................................................................... 2-24
BOOLEAN Character Expressions........................................................................................ 2-24
BOOLEAN Date Expressions................................................................................................. 2-25
Guidelines for PL/SQL BOOLEAN Expressions................................................................ 2-25
CASE Expressions........................................................................................................................... 2-26
Simple CASE expression......................................................................................................... 2-26
Searched CASE Expression .................................................................................................... 2-27
Handling Null Values in Comparisons and Conditional Statements..................................... 2-27
NULLs and the NOT Operator.............................................................................................. 2-28
Conditional Compilation..................................................................................................................... 2-30
How Does Conditional Compilation Work?............................................................................... 2-31
Conditional Compilation Control Tokens............................................................................ 2-31
Using Conditional Compilation Selection Directives......................................................... 2-31
Using Conditional Compilation Error Directives ............................................................... 2-31
Using Conditional Compilation Inquiry Directives ........................................................... 2-31
Using Predefined Inquiry Directives With Conditional Compilation ............................ 2-32
Using Static Expressions with Conditional Compilation................................................... 2-33
Setting the PLSQL_CCFLAGS Initialization Parameter..................................................... 2-34
Using DBMS_DB_VERSION Package Constants................................................................ 2-35
Conditional Compilation Examples............................................................................................. 2-35
Using Conditional Compilation to Specify Code for Database Versions........................ 2-35 Using DBMS_PREPROCESSOR Procedures to Print or Retrieve Source Text............... 2-36Conditional Compilation Restrictions.......................................................................................... 2-37
Using PL/SQL to Create Web Applications and Server Pages...................................................... 2-38
PL/SQL Web Applications............................................................................................................ 2-38
PL/SQL Server Pages..................................................................................................................... 2-38
Summary of PL/SQL Built-In Functions........................................................................................... 2-38
vi3 PL/SQL Datatypes
Overview of Predefined PL/SQL Datatypes....................................................................................... 3-1
PL/SQL Number Types.................................................................................................................... 3-2
BINARY_INTEGER Datatype................................................................................................... 3-2
BINARY_FLOAT and BINARY_DOUBLE Datatypes........................................................... 3-2
NUMBER Datatype .................................................................................................................... 3-3
PLS_INTEGER Datatype............................................................................................................ 3-4
PL/SQL Character and String Types.............................................................................................. 3-4
CHAR Datatype......................................................................................................................... 3-4
LONG and LONG RAW Datatypes......................................................................................... 3-5
RAW Datatype ............................................................................................................................ 3-6
ROWID and UROWID Datatype.............................................................................................. 3-6
VARCHAR2 Datatype................................................................................................................ 3-8
PL/SQL National Character Types................................................................................................. 3-9
Comparing UTF8 and AL16UTF16 Encodings....................................................................... 3-9
NCHAR Datatype....................................................................................................................... 3-9
NVARCHAR2 Datatype......................................................................................................... 3-10
PL/SQL LOB Types........................................................................................................................ 3-10
BFILE Datatype ........................................................................................................................ 3-11
BLOB Datatype......................................................................................................................... 3-11
CLOB Datatype ........................................................................................................................ 3-11
NCLOB Datatype..................................................................................................................... 3-12
PL/SQL Boolean Types.................................................................................................................. 3-12
BOOLEAN Datatype............................................................................................................... 3-12
PL/SQL Date, Time, and Interval Types..................................................................................... 3-12
DATE Datatype........................................................................................................................ 3-13
TIMESTAMP Datatype ........................................................................................................... 3-13
TIMESTAMP WITH TIME ZONE Datatype........................................................................ 3-14
TIMESTAMP WITH LOCAL TIME ZONE Datatype......................................................... 3-15
INTERVAL YEAR TO MONTH Datatype........................................................................... 3-16
INTERVAL DAY TO SECOND Datatype............................................................................ 3-16
Datetime and Interval Arithmetic................................................................................................. 3-17
Avoiding Truncation Problems Using Date and Time Subtypes............................................. 3-17
Overview of PL/SQL Subtypes........................................................................................................... 3-17
Defining Subtypes .......................................................................................................................... 3-18
Using Subtypes................................................................................................................................ 3-18
Type Compatibility With Subtypes....................................................................................... 3-19
Constraints and Default Values With Subtypes.................................................................. 3-20
Converting PL/SQL Datatypes........................................................................................................... 3-21
Explicit Conversion......................................................................................................................... 3-21
Implicit Conversion ........................................................................................................................ 3-21
Choosing Between Implicit and Explicit Conversion................................................................ 3-23
DATE Values ................................................................................................................................... 3-23
RAW and LONG RAW Values..................................................................................................... 3-23
Differences between the CHAR and VARCHAR2 Datatypes...................................................... 3-23
Assigning Character Values .......................................................................................................... 3-23
Comparing Character Values........................................................................................................ 3-24
viiInserting Character Values ............................................................................................................ 3-25
Selecting Character Values ............................................................................................................ 3-26
4 Using PL/SQL Control Structures
Overview of PL/SQL Control Structures............................................................................................. 4-1
Testing Conditions: IF and CASE Statements.................................................................................... 4-2
Using the IF-THEN Statement ......................................................................................................... 4-2
Using the IF-THEN-ELSE Statement............................................................................................... 4-2
Using the IF-THEN-ELSIF Statement.............................................................................................. 4-3
Using CASE Statements.................................................................................................................... 4-4
Searched CASE Statement......................................................................................................... 4-5
Guidelines for PL/SQL Conditional Statements........................................................................... 4-6
Controlling Loop Iterations: LOOP and EXIT Statements............................................................... 4-7
Using the LOOP Statement............................................................................................................... 4-7
Using the EXIT Statement................................................................................................................. 4-7
Using the EXIT-WHEN Statement................................................................................................... 4-8
Labeling a PL/SQL Loop.................................................................................................................. 4-8
Using the WHILE-LOOP Statement................................................................................................ 4-9
Using the FOR-LOOP Statement ..................................................................................................... 4-9
How PL/SQL Loops Iterate ................................................................................................... 4-10
Dynamic Ranges for Loop Bounds........................................................................................ 4-11
Scope of the Loop Counter Variable ..................................................................................... 4-11
Using the EXIT Statement in a FOR Loop............................................................................ 4-12
Sequential Control: GOTO and NULL Statements........................................................................ 4-13
Using the GOTO Statement........................................................................................................... 4-13
Restrictions on the GOTO Statement.................................................................................... 4-15
Using the NULL Statement............................................................................................................ 4-15
5 Using PL/SQL Collections and Records
What are PL/SQL Collections and Records?....................................................................................... 5-1
Understanding PL/SQL Collections............................................................................................... 5-2
Understanding Nested Tables................................................................................................... 5-2
Understanding Varrays.............................................................................................................. 5-3
Understanding Associative Arrays (Index-By Tables).......................................................... 5-3
How Globalization Settings Affect VARCHAR2 Keys for Associative Arrays................. 5-4Understanding PL/SQL Records..................................................................................................... 5-5
Choosing Which PL/SQL Collection Types to Use............................................................................ 5-5
Choosing Between Nested Tables and Associative Arrays......................................................... 5-5
Choosing Between Nested Tables and Varrays............................................................................. 5-5
Defining Collection Types and Declaring Collection Variables..................................................... 5-6
Declaring PL/SQL Collection Variables......................................................................................... 5-7
Initializing and Referencing Collections......................................................................................... 5-10
Referencing Collection Elements.................................................................................................. 5-11
Assigning Collections........................................................................................................................... 5-12
Comparing Collections......................................................................................................................... 5-16
Using Multilevel Collections.............................................................................................................. 5-18
viiiUsing Collection Methods................................................................................................................... 5-19
Checking If a Collection Element Exists (EXISTS Method) ...................................................... 5-19
Counting the Elements in a Collection (COUNT Method)....................................................... 5-20
Checking the Maximum Size of a Collection (LIMIT Method)................................................ 5-20
Finding the First or Last Collection Element (FIRST and LAST Methods) ............................ 5-21
Looping Through Collection Elements (PRIOR and NEXT Methods).................................... 5-22
Increasing the Size of a Collection (EXTEND Method)............................................................. 5-23
Decreasing the Size of a Collection (TRIM Method).................................................................. 5-24
Deleting Collection Elements (DELETE Method) ...................................................................... 5-25
Applying Methods to Collection Parameters.............................................................................. 5-26
Avoiding Collection Exceptions......................................................................................................... 5-27
Defining and Declaring Records........................................................................................................ 5-29
Using Records as Procedure Parameters and Function Return Values.................................. 5-31
Assigning Values to Records............................................................................................................... 5-32
Comparing Records........................................................................................................................ 5-33
Inserting PL/SQL Records into the Database............................................................................. 5-33
Updating the Database with PL/SQL Record Values............................................................... 5-34
Restrictions on Record Inserts and Updates ............................................................................... 5-35
Querying Data into Collections of Records................................................................................. 5-36
6 Performing SQL Operations from PL/SQL
Overview of SQL Support in PL/SQL.................................................................................................. 6-1
Data Manipulation............................................................................................................................. 6-1
Transaction Control........................................................................................................................... 6-3
SQL Functions..................................................................................................................................... 6-3
SQL Pseudocolumns.......................................................................................................................... 6-3
SQL Operators.................................................................................................................................... 6-6
Managing Cursors in PL/SQL................................................................................................................ 6-6
Implicit Cursors.................................................................................................................................. 6-6
Attributes of Implicit Cursors................................................................................................... 6-7
Guidelines for Using Attributes of Implicit Cursors............................................................. 6-8
Explicit Cursors.................................................................................................................................. 6-8
Declaring a Cursor...................................................................................................................... 6-8
Opening a Cursor........................................................................................................................ 6-9
Fetching with a Cursor............................................................................................................... 6-9
Fetching Bulk Data with a Cursor......................................................................................... 6-11
Closing a Cursor....................................................................................................................... 6-12
Attributes of Explicit Cursors ................................................................................................ 6-12
Querying Data with PL/SQL............................................................................................................... 6-14
Selecting At Most One Row: SELECT INTO Statement............................................................ 6-14
Selecting Multiple Rows: BULK COLLECT Clause................................................................... 6-15
Looping Through Multiple Rows: Cursor FOR Loop ............................................................... 6-15
Performing Complicated Query Processing: Explicit Cursors................................................. 6-15
Querying Data with PL/SQL: Implicit Cursor FOR Loop........................................................ 6-16
Querying Data with PL/SQL: Explicit Cursor FOR Loops ...................................................... 6-16
Defining Aliases for Expression Values in a Cursor FOR Loop............................................... 6-17
Using Subqueries.................................................................................................................................. 6-17
ixUsing Correlated Subqueries......................................................................................................... 6-18
Writing Maintainable PL/SQL Queries....................................................................................... 6-19
Using Cursor Variables (REF CURSORs)......................................................................................... 6-20
What Are Cursor Variables (REF CURSORs)?............................................................................ 6-20
Why Use Cursor Variables?........................................................................................................... 6-20
Declaring REF CURSOR Types and Cursor Variables.............................................................. 6-20
Passing Cursor Variables As Parameters............................................................................. 6-22
Controlling Cursor Variables: OPEN-FOR, FETCH, and CLOSE............................................ 6-22
Opening a Cursor Variable..................................................................................................... 6-22
Using a Cursor Variable as a Host Variable......................................................................... 6-24
Fetching from a Cursor Variable ........................................................................................... 6-25
Closing a Cursor Variable....................................................................................................... 6-26
Reducing Network Traffic When Passing Host Cursor Variables to PL/SQL...................... 6-26Avoiding Errors with Cursor Variables....................................................................................... 6-27
Restrictions on Cursor Variables .................................................................................................. 6-27
Using Cursor Expressions.................................................................................................................... 6-28
Restrictions on Cursor Expressions.............................................................................................. 6-28
Example of Cursor Expressions.................................................................................................... 6-29
Constructing REF CURSORs with Cursor Subqueries.............................................................. 6-29
Overview of Transaction Processing in PL/SQL............................................................................. 6-30
Using COMMIT in PL/SQL .......................................................................................................... 6-30
Using ROLLBACK in PL/SQL...................................................................................................... 6-31
Using SAVEPOINT in PL/SQL .................................................................................................... 6-31
How Oracle Does Implicit Rollbacks ........................................................................................... 6-32
Ending Transactions....................................................................................................................... 6-33
Setting Transaction Properties with SET TRANSACTION ...................................................... 6-33
Restrictions on SET TRANSACTION ................................................................................... 6-34
Overriding Default Locking .......................................................................................................... 6-34
Doing Independent Units of Work with Autonomous Transactions.......................................... 6-37
Advantages of Autonomous Transactions.................................................................................. 6-37
Defining Autonomous Transactions............................................................................................ 6-37
Comparison of Autonomous Transactions and Nested Transactions............................. 6-39Transaction Context................................................................................................................. 6-39
Transaction Visibility............................................................................................................... 6-39
Controlling Autonomous Transactions ....................................................................................... 6-39
Using Autonomous Triggers......................................................................................................... 6-41
Calling Autonomous Functions from SQL.................................................................................. 6-42
7 Performing SQL Operations with Native Dynamic SQL
Why Use Dynamic SQL with PL/SQL?................................................................................................ 7-1
Using the EXECUTE IMMEDIATE Statement in PL/SQL............................................................... 7-2
Specifying Parameter Modes for Bind Variables in Dynamic SQL Strings............................... 7-4
Using Bulk Dynamic SQL in PL/SQL.................................................................................................. 7-5
Using Dynamic SQL with Bulk SQL............................................................................................... 7-5
Examples of Dynamic Bulk Binds ................................................................................................... 7-6
Guidelines for Using Dynamic SQL with PL/SQL............................................................................ 7-7
Building a Dynamic Query with Dynamic SQL............................................................................ 7-7
xWhen to Use or Omit the Semicolon with Dynamic SQL............................................................ 7-7
Improving Performance of Dynamic SQL with Bind Variables.................................................. 7-8
Passing Schema Object Names As Parameters.............................................................................. 7-8
Using Duplicate Placeholders with Dynamic SQL ....................................................................... 7-9
Using Cursor Attributes with Dynamic SQL................................................................................. 7-9
Passing Nulls to Dynamic SQL..................................................................................................... 7-10
Using Database Links with Dynamic SQL.................................................................................. 7-10
Using Invoker Rights with Dynamic SQL................................................................................... 7-11
Using Pragma RESTRICT_REFERENCES with Dynamic SQL................................................ 7-11
Avoiding Deadlocks with Dynamic SQL .................................................................................... 7-11
Backward Compatibility of the USING Clause.......................................................................... 7-12
Using Dynamic SQL With PL/SQL Records and Collections.................................................. 7-12
8 Using PL/SQL Subprograms
What Are Subprograms?......................................................................................................................... 8-1
Advantages of PL/SQL Subprograms................................................................................................... 8-2
Understanding PL/SQL Procedures...................................................................................................... 8-3
Understanding PL/SQL Functions........................................................................................................ 8-4
Using the RETURN Statement......................................................................................................... 8-5
Declaring Nested PL/SQL Subprograms............................................................................................. 8-5
Passing Parameters to PL/SQL Subprograms..................................................................................... 8-6
Actual Versus Formal Subprogram Parameters............................................................................ 8-6
Using Positional, Named, or Mixed Notation for Subprogram Parameters............................. 8-7
Specifying Subprogram Parameter Modes..................................................................................... 8-7
Using the IN Mode ..................................................................................................................... 8-7
Using the OUT Mode ................................................................................................................. 8-8
Using the IN OUT Mode............................................................................................................ 8-8
Summary of Subprogram Parameter Modes.......................................................................... 8-9
Using Default Values for Subprogram Parameters....................................................................... 8-9
Overloading Subprogram Names...................................................................................................... 8-10
Guidelines for Overloading with Numeric Types ..................................................................... 8-10
quotesdbs_dbs17.pdfusesText_23