Deterministic Functions
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Deterministic Functions

  1. #1
    Join Date
    Nov 2001
    Location
    UK
    Posts
    152
    Does anyone know how I make a user-defined function "deterministic" ? I've written a complex text processing function against which I would like to create a function based index. However, I just get the error "ORA-30533: The function is not deterministic" when I try to create the index. The manual helpfully tells me that the solution is to make the function deterministic, but doesn't explain how.

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,095
    DETERMINISTIC (in terms of FBI's) means that for a given set of inputs the function will always return the same result.

    For example, TO_CHAR(date_field) always returns the same result, whereas TO_CHAR(sysdate - date_field) returns a different result depending on what day it is.

    Note: You can add the DETERMINISTIC keyword to any function. See docs for details...
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938
    You need to indicate that the function will always return the same value for any given set of input arguments.

    Here is an example for you:

    create or replace function ala_bala
    return number
    deterministic
    as
    x number;
    begin
    select 3.14 into x from dual;
    return x;
    end;
    /



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width