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 |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access