New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle...

Preview:

Citation preview

Confidential & Proprietary 1 1

New Features of Oracle 11g

By

Beena V T

Confidential & Proprietary 2 2

AGENDA

• Features of 11g

• 11g Features in detail

• Key Points - Coding PL/SQL program.

• Questions and Answers

Confidential & Proprietary 3 3

Features of 11g

Confidential & Proprietary 4 4

Features of 11g

Following are the Oracle Features of 11g

Virtual Column

REGEXP_COUNT function

Inline Pragma

New PLSQL compiler warning

PLSQL sub-program invocation

Restrictions in FORALL

Type with force option

Generalized Invocation

Trigger Enhancements

Fine grained dependency tracking

Confidential & Proprietary 5 5

Virtual Column

Confidential & Proprietary 6 6

Virtual Column

A column value is derived from an expression.

Oracle doesn't store any data related to virtual column.

Only expression is stored in data dictionary.

Virtual columns can be referenced in the WHERE clause.

Index-organized, external, object, cluster, temporary tables not supported

Confidential & Proprietary 7 7

Virtual Column – An Example

Virtual Column

Confidential & Proprietary 8 8

Virtual Column

The expression used in the virtual column definition has the following

restrictions:

It cannot refer to another virtual column by name.

It can only refer to columns defined in the same table.

If it refers to a deterministic user-defined function, it cannot be used as

a partitioning key column.

Cannot return an Oracle supplied, user-defined, or LOB or LONG

RAW.

Confidential & Proprietary 9 9

REGEXP_COUNT function

Confidential & Proprietary 10 10

REGEXP_COUNT Function

REGEXP_COUNT function returns number of times a pattern occurs in a source

string.

Syntax: REGEXP_COUNT(source_char,pattern, position, match_param)

SOURCE_CHAR is a character expression which is the search value.

PATTERN is the regular expression, which will be matched

POSITION is a positive integer from where search should begin

Confidential & Proprietary 11 11

REGEXP_COUNT – An Example

MATCH_PARAM is a text literal, controls matching behavior.

'i' specifies case-insensitive matching.

'c' specifies case-sensitive matching.

'n' allows a period (.) wild character to match a newline

'm‘ parses the source string as individual lines

'x' ignores whitespace characters.

Confidential & Proprietary 12 12

MATCH_PARAM is a text literal, controls matching behavior.

• 'i' specifies case-insensitive matching.

• 'c' specifies case-sensitive matching.

• 'n' allows a period (.) wild character to match a newline

• 'm‘ parses the source string as individual lines

• 'x' ignores whitespace characters.

Source_Char

Pattern

Position

Match_Param

REGEXP_COUNT – An Example

Confidential & Proprietary 13 13

Inline Pragma

Confidential & Proprietary 14 14

INLINE Pragma –Example 1

Confidential & Proprietary 15 15

INLINE Pragma

Every call to a procedure or function causes performance overhead.

This is noticeable when subprogram is called within a loop.

Avoiding procedures and functions is not an option.

Automatic subprogram inlining can reduce the overheads associated.

Replaces subprogram calls with a copy of the code at compile time.

Confidential & Proprietary 16 16

INLINE Pragma

Subprogram inlining controlled by PLSQL_OPTIMIZE_LEVEL

When PLSQL_OPTIMIZE_LEVEL=2 (the default).

PLSQL_OPTIMIZE_LEVEL=3, may inline code automatically.

INLINE pragma can turn on/off inlining.

Confidential & Proprietary 17 17

INLINE Pragma – Example 2

Confidential & Proprietary 18 18

INLINE Pragma – Example 2

Confidential & Proprietary 19 19

INLINE Pragma – Example 3

Confidential & Proprietary 20 20

INLINE Pragma Example 3

Confidential & Proprietary 21 21

INLINE Pragma

The INLINE pragma only affects the following types of statements,

• Assignment

• Call

• Conditional

• CASE

• CONTINUE-WHEN

• EXECUTE IMMEDIATE

• EXIT-WHEN

• LOOP

• RETURN

Confidential & Proprietary 22 22

Compiler Warning

Confidential & Proprietary 23 23

Compiler Warning

Before11g,

Confidential & Proprietary 24 24

Compiler Warning

In 11g, warning when exception handlers do not re-raise errors.

Note: This is only a warning message, so it only identifies

possible problem code, it doesn't prevent it.

Confidential & Proprietary 25 25

Compiler Warning

In 11g, warning when exception handlers do not re-raise errors.

Note: This is only a warning message, so it only identifies

possible problem code, it doesn't prevent it.

Warning

Confidential & Proprietary 26 26

Sub-Program Invocation

Confidential & Proprietary 27 27

PL/SQL Subprogram Invocations

Prior to 11g, only positional notation is allowed.

Oracle 11g allows positional, named and mixed notation.

Positional

Mixed

Confidential & Proprietary 28 28

Restrictions in FORALL

Confidential & Proprietary 29 29

FORALL Restriction

Before11g,

Update Entire

Row

Confidential & Proprietary 30 30

FORALL Restriction

In 11g, PLS-00436 restriction has been removed.

Columns can be referenced in SET and WHERE clauses of DML statements.

Update Selected

Column

Confidential & Proprietary 31 31

FORALL Restriction

SET and WHERE clauses contain references to individual columns in collection.

Using bulk-binds for DML is made easier.

Improved performance on update operation

No need to use ROW keyword, no longer whole row update required

Confidential & Proprietary 32 32

Type with force option

Confidential & Proprietary 33 33

Creating TYPE OBJECT,

Creating TYPE TABLE with OBJECT,

TYPE with FORCE option

Confidential & Proprietary 34 34

Try Altering TYPE OBJECT without FORCE option,

With FORCE option,

TYPE with FORCE option

Confidential & Proprietary 35 35

TYPE with FORCE option

Before11g, cannot replace type, with type or table dependencies.

In 11g, FORCE is used to overcome this issue

Applies to objects, varrays, and nested table types.

Also applies to inheritance in types.

Table dependencies still cause errors.

Confidential & Proprietary 36 36

Generalized Invocation

Confidential & Proprietary 37 37

Generalized Invocation

Allows a subtype to invoke a method of a parent type (supertype).

Syntax:

Example:

Step 1: Create type with some attribute and member function

Confidential & Proprietary 38 38

Generalized Invocation

Step 2: Create a subtype of this object, as below,

Confidential & Proprietary 39 39

Generalized Invocation

Step 3: Access method of parent type by calling subtype.

Note: Member functions of parent type can be invoked,

regardless of the depth of inheritance.

Confidential & Proprietary 40 40

Trigger Enhancements

Confidential & Proprietary 41 41

Execution Order – An Example

Before 11g,

Confidential & Proprietary 42 42

Execution Order

More than one trigger can be created for the same timing point.

In 10g, execution order of those triggers not guaranteed.

Oracle 11g now includes FOLLOWS clause to guarantee execution order.

Confidential & Proprietary 43 43

Execution Order – An Example

Confidential & Proprietary 44 44

Execution Order – An Example

Confidential & Proprietary 45 45

Compound Triggers

Allows code for one or more timing points to be combined into a single trigger.

The individual timing points can share a single global declaration section

Once a statement ends, trigger state is cleaned up.

Triggering actions are defined in the same way as any other DML trigger.

Confidential & Proprietary 46 46

Compound Triggers

Main body of the trigger has an optional global declaration section.

Each timing point sections contains a local declaration section.

Compound

Trigger

Confidential & Proprietary 47 47

Enable/ Disable Triggers

Triggers can be Enabled or Disabled explicitly at the time of creation in 11g

Confidential & Proprietary 48 48

Fine grained dependency

tracking

Confidential & Proprietary 49 49

Fine Grained Dependency

If referenced Object's Structure or definition is modified,

In Conventional Dependency Model,

• Dependent object will be marked "invalid' in data dictionary.

In New Dependency Model in 11g,

• Dependencies across objects can be tracked down up to object level.

Fine Grained Dependency is the one of key enhancement in Oracle 11g.

In 11g, object dependency concept moved from Object level into column level .

This will assure the minimum hindrance object Validation.

Confidential & Proprietary 50 50

Q & A

Confidential & Proprietary 51 51

Thank You

Recommended