Chapter 8 SQL Functions
341
expression-2 The return value if expression-1 is NULL.
expression-3 The return value if expression-1 is not NULL.
The following statement returns the value –66:
SELECT IFNULL( NULL, -66 )
The following statement: returns NULL, because the first expression is not
NULL and there is no third expression:
SELECT IFNULL( -66, -66 )
♦ SQL/92 Transact-SQL extension.
♦
Sybase Not supported by Adaptive Server Enterprise.
INDEX_ESTIMATE function [Miscellaneous]
This function is the same as the ESTIMATE function, except that it always
looks only in an index.
INDEX_ESTIMATE(
column-name
,
number
[ ,
relation-string
] )
column-name The name of the column that is used in the estimate.
number If number is specified, the function returns as a REAL the
percentage estimate that the query optimizer uses.
relation-string The relation-string must be a comparison operator
enclosed in single quotes; the default is ’=’.
The following statement returns the value 81.304607.
SELECT DISTINCT ESTIMATE( emp_id, 200, ’>’ )
FROM employee
♦ SQL/92
♦
Sybase Not supported in Adaptive Server Enterprise.
INSERTSTR function [String]
Inserts a string into another string at a specified position.
INSERTSTR (
integer-expression
,
string-expression-1
,
string-expression-2
)
integer expression The position after which the string is to be inserted.
Use zero to insert a string at the beginning.
Examples
Standards and
compatibility
Function
Syntax
Parameters
Examples
Standards and
compatibility
Function
Syntax
Parameters