Which two statements are true regarding single row functions?
A.
MOD: returns the quotient of a division
B.
TRUNC: can be used with number and date values
C.
CONCAT: can be used to combine any number of values
D.
SYSDATE: returns the database server current date and time
E.
INSTR: can be used to find only the first occurrence of a character in a string
F.
TRIM: can be used to remove all the occurrences of a character from a string
Explanation:
ROUND: Rounds value to a specified decimal
TRUNC: Truncates value to a specified decimal
MOD: Returns remainder of division
SYSDATE is a date function that returns the current database server date and time.
Date-Manipulation Functions
Date functions operate on Oracle dates. All date functions return a value of the DATE data type
except MONTHS_BETWEEN, which returns a numeric value.
MONTHS_BETWEEN(date1, date2): Finds the number of months between date1 and date2. Theresult can be positive or negative. If date1 is later than date2, the result is positive; if date1 is
earlier than date2, the result is negative. The noninteger part of the result represents a portion of
the month.
ADD_MONTHS(date, n): Adds n number of calendar months to date. The value of n must be an
integer and can be negative.
NEXT_DAY(date, ‘char’): Finds the date of the next specified day of the week (‘char’) following
date. The value of char may be a number representing a day or a character string.
LAST_DAY(date): Finds the date of the last day of the month that contains date
The above list is a subset of the available date functions. ROUND and TRUNC number functions
can also be used to manipulate the date values as shown below:
ROUND(date[, ‘fmt’]): Returns date rounded to the unit that is specified by the format model fmt. If
the format model fmt is omitted, date is rounded to the nearest day.
TRUNC(date[, ‘fmt’]): Returns date with the time portion of the day truncated to the unit that is
specified by the format model fmt. If the format model fmt is omitted, date is truncated to the
nearest day.
The CONCAT Function
The CONCAT function joins two character literals, columns, or expressions to yield one larger
character expression. Numeric and date literals are implicitly cast as characters when they occur
as parameters to the CONCAT function. Numeric or date expressions are evaluated before being
converted to strings ready to be concatenated. The CONCAT function takes two parameters. Its
syntax is CONCAT(s1, s2), where s1 and s2 represent string literals, character column values, or
expressions resulting in character values.
The INSTR(source string, search item, [start position], [nth occurrence of search item]) function
returns a number that represents the position in the source string, beginning from the given start
position, where the nth occurrence of the search item begins:
instr(‘http://www.domain.com’, ‘.’, 1, 2) = 18
The TRIM function literally trims off leading or trailing (or both) character strings from a given
source string:
Yes, B & C are correct.
B & D. C is wrong.
C is wrong, because concat function only works with 2 values.