CURRENT_USER function
Derby Reference Manual
126
-- or, alternately:
VALUES CURRENT TIMESTAMP
CURRENT_USER function
When used outside stored routines, CURRENT_USER,
, and
return the authorization identifier of the user that created the SQL session.
SESSION_USER also always returns this value when used within stored routines.
If used within a stored routine created with EXTERNAL SECURITY DEFINER, however,
CURRENT_USER and USER return the authorization identifier of the user that owns the
schema of the routine. This is usually the creating user, although the database owner
could be the creator as well.
For information about definer's and invoker's rights, see
.
These functions return a string of up to 128 characters.
Syntax
CURRENT_USER
Example
VALUES CURRENT_USER
DATE function
The DATE function returns a date from a value.
The argument must be a date, timestamp, a positive number less than or equal to
2,932,897, a valid string representation of a date or timestamp, or a string of length 7 that
is not a CLOB, LONG VARCHAR, or XML value. If the argument is a string of length 7, it
must represent a valid date in the form yyyynnn, where yyyy are digits denoting a year,
and nnn are digits between 001 and 366, denoting a day of that year. The result of the
function is a date. If the argument can be null, the result can be null; if the argument is
null, the result is the null value.
The other rules depend on the data type of the argument specified:
· If the argument is a date, timestamp, or valid string representation of a date or
timestamp: The result is the date part of the value.
· If the argument is a number: The result is the date that is n-1 days after January 1,
1970, where n is the integral part of the number.
· If the argument is a string with a length of 7: The result is the date represented by
the string.
Syntax
DATE ( expression )
Examples
This example results in an internal representation of '1988-12-25'.
VALUES DATE('1988-12-25')
This example results in an internal representation of '1972-02-28'.
VALUES DATE(789)