Kihagyás

Kotlin de-tour

This section is needed since The UDT topic uses plenty of things that needs to be explained

PRAGMA - RESTRICT_REFERENCES

Hints the system that your function obey certain "purity" rules, which control side-effect

A violation on such hints will cause a runtime error, so it shall be used with caution.

Motivation

DBMSs are all about query optimization, so wherever you can hint your intend, you as the dev shall aid the system

The less sife-effect a function has, the better it can be optimized within a query. Certain PRAGMAs has a bigger impact on performance than the others (PARALEL_ENABLE and DETERMINISTIC mostly).

Syntax

PRAGMA RESTRICT_REFERENCES ([<function_name> | DEFAULT] , <RNDS | WDNS | WNDS | RNPS | WNPS | TRUST> );

From the source:

PRAGMA RESTRICT_REFERENCES

Values

DEFAULT

Specifies that the pragma applies to all subprograms in the package spec or object type spec. You can still declare the pragma for individual subprograms (overriding this setting).

RNDS

Asserts that the subprogram reads no database state (does not query database tables).

RNPS

Asserts that the subprogram reads no package state (does not reference the values of packaged variables)

TRUST

Asserts that the subprogram can be trusted not to violate one or more rules. This value is needed for functions written in C or Java that are called from PL/SQL, since PL/SQL cannot verify them at run time.

WNDS

Asserts that the subprogram writes no database state (does not modify database tables).

WNPS

Asserts that the subprogram writes no package state (does not change the values of packaged variables).