Built-in Scalar Functions
SQL2003 built-in scalar functions identify both the current user session and the characteristics of the current user session, such as the current session privileges. Built-in scalar functions are always nondeterministic. The CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP functions listed in Table 4-3 are built-in functions that fall into the date-and-time category of functions. Although the five platforms provide many additional functions beyond these SQL built-ins, the SQL standard defines only those listed in Table 4-3.
Function |
Usage |
CURRENT_DATE |
Returns the current date. |
CURRENT_TIME |
Returns the current time. |
CURRENT_TIMESTAMP |
Returns the current date and time. |
CURRENT_USER or USER |
Returns the currently active user within the database server. |
SESSION_USER |
Returns the currently active Authorization ID, if it differs from the user. |
SYSTEM_USER |
Returns the currently active user within the host operating system. |
Get SQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.