SQL$HELP_OLD72.HLB  —  ALTER  FUNCTION  Examples
    Example 1: Changing a function to be NOT DETERMINISTIC

    When a function is created it is assumed to be DETERMINISTIC.
    That is, given the same input values it should return the same
    result. When a routine has no parameters, such as the GET_TIME
    function shown below, then there is never any variation in the
    input. In this case the function should have been defined as NOT
    DETERMINISTIC to ensure that the Rdb optimizer calls it for each
    row processed, instead of using the previously returned result
    for each row.

    Although DROP FUNCTION and CREATE FUNCTION could have performed
    the same function, ALTER FUNCTION preserves the dependencies that
    exist in the database.

    SQL> alter function GET_TIME
    cont>     not deterministic
    cont>     comment 'Fetch time from clock'
    cont>     /       'Every call must be executed, so change to be'
    cont>     /       'NOT DETERMINISTIC';
    SQL>
    SQL> show function GET_TIME;
    Information for function GET_TIME

     Function is Not Deterministic (variant)
     Function ID is: 262
     External Location is: SYS$SHARE:CLOCKSHR.EXE
     Entry Point is: GET_TIME
     Comment:       Fetch time from clock
                    Every call must be executed, so change to be
                    NOT DETERMINISTIC
     Language is: COBOL
     GENERAL parameter passing style used
     Number of parameters is: 0

    Parameter Name                  Data Type        Domain or Type
    --------------                  ---------        --------------
                                    TIME(2)
            Function result datatype
            Return value is passed by value
Close Help