New and changed functions

New function returns data type of an expression The EXPRTYPE function returns the data type of an expression. For best performance, avoid using the EXPRTYPE function in predicates, as CIS functional compensation performance considerations apply. For more information, see “EXPRTYPE function [Miscellaneous]” in Adaptive Server Anywhere SQL Reference.

Variable test function A new function VAREXISTS is available to test whether a user-defined variable has been created or declared with a given name. After this test, the variable can be created if necessary, and then used safely. For best performance, avoid using the VAREXISTS function in predicates, as CIS functional compensation performance considerations apply. For more information, see “VAREXISTS function [Miscellaneous]” in Adaptive Server Anywhere SQL Reference.

Three new values can be passed to the event_parameter function Three new values can be passed to the event_parameter function. ScheduleName returns the name of the schedule which fired the event. AppInfo returns the value of the connection_property('AppInfo') for the connection which caused the event. DisconnectReason returns a string indicating why the connection terminated.

For more information, see “EVENT_PARAMETER function [System]” in Sybase IQ Reference Manual.

Non-deterministic functions Functions that modify underlying data, or that rely on underlying data that may change during the course of query execution, can be declared NOT DETERMINISTIC. Functions that are declared this way are re-evaluated each time they are called during query execution. Otherwise, the function value is cached and reused for better performance. For best performance, avoid use of this feature in predicates, as CIS functional compensation performance considerations apply.

For more information, see CREATE FUNCTION statement in Sybase IQ Reference Manual.

User-defined functions (behavior change) User defined function parameters and return values are now cached. If a function is used several times within a SQL statement, the cached parameter values may result in the cached result being used, instead of the function being evaluated again. In previous releases, user-defined functions were re-evaluated each time they were needed. The new behavior provides more consistent results, but may change results compared to previous releases of the software.

Some functions treated as non-deterministic (behavior change) The RAND, NEWID, and GET_IDENTITY functions are treated as non-deterministic. This means that they do not always return the same result for a given set of parameters, or that they have other side effects on the underlying data. A consequence is that these functions are not cached during query execution.

New extended property function added The new db_extended_property() is similar to db_property() except that it also allows an optional property-specific string parameter to be specified. For more information, see “DB_EXTENDED_PROPERTY function [System]” in Adaptive Server Anywhere SQL Reference.

New embedded SQL function to obtain database properties The function db_get_property can be used to obtain database properties. For more information, see “db_get_property function” in Adaptive Server Anywhere Programming Guide.