Built-in Scalar Functions
ANSI SQL built-in scalar functions identify both the current user session and its characteristics, 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 four platforms discussed in this book 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’s ID |
SYSTEM_USER | Returns the currently active user within the host operating system |
Get SQL in a Nutshell, 3rd 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.