x

What is a deterministic function?

What is a deterministic function? What are the advantages if we define a function as a determnisitic?

Thanks in advance Regards

BI DWH BALA

more ▼

asked Nov 26, 2009 at 05:32 PM in Default

BI DWH BALA gravatar image

BI DWH BALA
606 41 60 62

(comments are locked)
10|1200 characters needed characters left

1 answer: sort oldest

A deterministic function gives always the same result to given parameters. The result of a deterministic function depends only from the input. It can have more than one parameter.

Samples of deterministic functions: length, to_upper, trunc, substr

Oracle uses deterministic functions building function based indexes. Be deterministic is necessary because oracle stores the function result into a normal index. At query time the optimizer calls the function again for query parameters but not for all table values.

more ▼

answered Nov 27, 2009 at 05:45 AM

Christian13467 gravatar image

Christian13467
846 2

HI.. Can we define a procedure also deterministic?
Nov 27, 2009 at 02:22 PM BI DWH BALA
No. Only plsql functions can be defined to be deterministic. Procedures cannot be used in places where functions should be deterministic.
Nov 30, 2009 at 06:22 AM Christian13467
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x378
x19

asked: Nov 26, 2009 at 05:32 PM

Seen: 1914 times

Last Updated: Dec 15, 2009 at 08:47 PM