new features of oracle 11g - aioug & proprietary 4 features of 11g following are the oracle...

51
Confidential & Proprietary 1 1 New Features of Oracle 11g By Beena V T

Upload: ngoanh

Post on 20-May-2018

248 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 1 1

New Features of Oracle 11g

By

Beena V T

Page 2: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 2 2

AGENDA

• Features of 11g

• 11g Features in detail

• Key Points - Coding PL/SQL program.

• Questions and Answers

Page 3: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 3 3

Features of 11g

Page 4: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 5: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 5 5

Virtual Column

Page 6: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 7: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 7 7

Virtual Column – An Example

Virtual Column

Page 8: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 9: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 9 9

REGEXP_COUNT function

Page 10: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 11: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 12: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 13: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 13 13

Inline Pragma

Page 14: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 14 14

INLINE Pragma –Example 1

Page 15: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 16: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 17: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 17 17

INLINE Pragma – Example 2

Page 18: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 18 18

INLINE Pragma – Example 2

Page 19: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 19 19

INLINE Pragma – Example 3

Page 20: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 20 20

INLINE Pragma Example 3

Page 21: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 22: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 22 22

Compiler Warning

Page 23: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 23 23

Compiler Warning

Before11g,

Page 24: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 25: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 26: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 26 26

Sub-Program Invocation

Page 27: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 28: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 28 28

Restrictions in FORALL

Page 29: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 29 29

FORALL Restriction

Before11g,

Update Entire

Row

Page 30: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 31: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 32: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 32 32

Type with force option

Page 33: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 33 33

Creating TYPE OBJECT,

Creating TYPE TABLE with OBJECT,

TYPE with FORCE option

Page 34: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 34 34

Try Altering TYPE OBJECT without FORCE option,

With FORCE option,

TYPE with FORCE option

Page 35: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 36: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 36 36

Generalized Invocation

Page 37: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 38: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 38 38

Generalized Invocation

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

Page 39: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 40: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 40 40

Trigger Enhancements

Page 41: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 41 41

Execution Order – An Example

Before 11g,

Page 42: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 43: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 43 43

Execution Order – An Example

Page 44: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 44 44

Execution Order – An Example

Page 45: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 46: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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

Page 47: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 47 47

Enable/ Disable Triggers

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

Page 48: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 48 48

Fine grained dependency

tracking

Page 49: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

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.

Page 50: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 50 50

Q & A

Page 51: New Features of Oracle 11g - AIOUG & Proprietary 4 Features of 11g Following are the Oracle Features of 11g Virtual Column REGEXP_COUNT function Inline Pragma New PLSQL compiler warning

Confidential & Proprietary 51 51

Thank You