Predefined Variables for Expressions

See Also      Tasks

In addition to using column names, literals, operators, and functions in an expression, you can use predefined variables that have defined meanings or values. For example, you can use a predefined variable to display the user name for the current user or to search for data columns that contain no value (null).

The predefined variables you can use depend on the database you are querying. Refer to the documentation for the database for details about what predefined variables are available.

Note   In some instances, a predefined variable might be available as a function. For example, one database might use the predefined variable CURRENT_USER, while another database might make the same information available as the function USER_NAME( ). Refer to the database documentation for details.

The list below includes examples of predefined variables that are available in some databases, such as Microsoft® SQL Server™.

Note   For more details about keywords avaiable in SQL Server, see Query Designer Considerations for SQL Server Databases. For details about predefined variables in Oracle (referred to as pseudo-columns, see Query Designer Considerations for Oracle Databases.

Predefined Variable Description Example
CURRENT_USER The user name of the current user
UPDATE accounts 
SET salesperson = CURRENT_USER
WHERE region = 'NW'

Changes the salesperson column for all accounts in the northwest region to the name of the current user.

NULL A null value, used in the search expressions
IS NULL and
IS NOT NULL1
SELECT emp_id, lname, fname, minit
FROM employee
WHERE minit IS NULL

Finds authors who have no middle initial.


1The keyword IS is a special operator for use with NULL.