Deterministic in Oracle

Source: Internet
Author: User
Deterministic clause

Specify deterministic to indicate that the function returns the same result value whenever it is called with the same values for its arguments.

You must specify this keyword if you intend to call the function in the expression of a function-based index or from the query of a materialized view that is marked refresh fast or enable query rewrite. when Oracle Database encounters a deterministic function in one of these contexts, it attempts to use previously calculated results when possible rather than reexecuting the function. if you subsequently change the semantics of the function, you must manually rebuild all dependent function-based indexes and materialized views.

Do not specify this clause to define a function that uses package variables or that accesses the database in any way that might affect the return result of the function. the results of doing so will not be captured if Oracle Database chooses not to reexecute the function.

The following Semantic Rules govern the use of the deterministic clause:

You can declare a top-level subprogram deterministic.

You can declare a package-level subprogram deterministic in the package specification but not in the package body.

You cannot declare deterministic a private subprogram (declared inside another subprogram or inside a package body ).

A Deterministic subprogram can call another subprogram whether the called program is declared deterministic or not.

This keyword indicates that if your function has the same input, the same result will be returned.

In this way, the database uses the previously calculated value instead of re-computing it.

This will be of great benefit for using function indexes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.