Monday, 23 February 2015

SQL Functions

Oracle function list in alphabetical order
Name
Description
ABS(x)
absolute value of x
ACOS(n)
Arccosine
ADD_MONTHS(d, n)
Date d plus n months
Gives the ASCII value of the first character of a string.
Converts x to an ASCII string, where x may be a string in any character set.
ASIN(n)
Arcsine of n
ATAN(n)
Arctangent of n
ATAN2(x,y)
Returns the arctangent of x and y.
Calculates the average
Converts a binary number x to a NUMBER.
BITAND(x,y)
a bitwise AND on x and y.
Converts x to a compatible type specified in type.
Returns the ceiling value (next highest integer above a number).
Converts x to a ROWID.
CHR(n)
Character with ASCII value n
COALESCE(a, b, ...)
The first not NULL argument (and NULL if all arguments are NULL)
Converts x to a Unicode string in normalized form.
Concatenates two strings
Converts x from source_char_set to dest_char_set.
COS(n)
Cosine of n (n expressed in radians)
COSH(n)
Hyperbolic cosine of n
Returns the number of rows returned by a query involving x
Returns rows containing a subtotal for all combinations of columns
Returns the position of a value relative to a group.
returns the current date in the local time zone in the database session
Returns a TIMESTAMP WITH TIME ZONE for the session
Returns the time zone for the database
Use it as if then else statement
Decomposes the string into the same character set as x and convert x to a Unicode string.
Rank the rows and does not skip ties
Returns e raised to a value.
Extracts and returns the year, month, day, hour, minute, second, or time zone from x.
EXTRACT(c FROM d)
Extract date/time component c from expression d
FIRSTFirst
gets the first values in an ordered group.
Gets the first rows in a window.
Returns the floor value (next lowest integer below number).
FROM_TZ(x, time_zone)
Merges xand time_zone into one value.
GREATEST(a, b, ...)
Greatest value of the function arguments
Removes duplicate rows returned by a ROLLUP or CUBE.
Deals with NULL value for ROLLUP and CUBE
Returns the decimal equivalent of the GROUPING bit vector.
Converts the character x containing hexadecimal digits (base-16) to a binary number (RAW).
Rank and Distribution Functions
Changes the first letter of a string or series of words into uppercase.
Returns the beginning location of a pattern in a given string.
gets the last values in an ordered group.
Last day of the month containing date d
Gets the last rows in a window.
LEAST(a, b, ...)
Least value of the function arguments
Returns the length of a string.
LN(n),LOG(m,n)
Natural logarithm, and logarithm base m
Returns a TIMESTAMP for the session.
Converts every letter of a string to lowercase.
Adds a specified set of characters to the left of the original string.
Removes a set of characters from the left of a string.
Returns the maximum value
Returns the median value
Returns the minimum value
Returns The Remainder Of N/M Where Both N And M Are Integers.
Months between dates d and e
NEW_TIME(x,time_zone1,time_zone2)
Converts x from time_zone1 to time_zone2
NEW_TIME(d, z1, z2)
Convert date/time d from time zone z1 to z2
NEXT_DAY(d, weekday)
The first weekday (mon, tue, etc.) after d
Groups data by putting data into a number of percentile groups
NULLIF(a, b)
NULL if a = b; otherwise a
Converts the number x to an INTERVAL DAY TO SECOND.
Converts number x to INTERVAL DAY TO SECOND.
Converts the number x to an INTERVAL YEAR TO MONTH.
Converts number x to INTERVAL YEAR TO MONTH.
Returns value if x is null; otherwise x is returned.
Returns value1 if x is not null; otherwise value2 is returned.
Separate data groups and perform calculation within that group
Returns the percent rank of a value relative to a group.
Checks the percent rank values in each group
Checks the cumulative distribution values
Returns value raised to some exponential power.
Returns the rank of items in a group and leaves a gap for a tie.
Ratio to report
Converts the binary number (RAW) x to a VARCHAR2string in equivalent hexadecimal number.
Converts the binary number (RAW) x to an NVARCHAR2string in the equivalent hexadecimal number.
Returns the number of times the pattern is found.
Returns the location of a pattern in a given string and supports the regular expression.
Searches x for the regular expression defined in the pattern parameter.
Replaces string with the regular expression matching supports
Returns the substring with the regular expression matching supports
REGR_AVGX(y, x)
Returns the average of x after eliminating x and y pairs
REGR_AVGY(y, x)
Returns the average of y after eliminating x and y pairs
REGR_COUNT(y, x)
Returns the number of non-null number pairs that are used to fit the regression line
Returns the intercept on the y-axis of the regression line
REGR_R2(y, x)
Returns the coefficient of determination of the regression line
REGR_SLOPE(y, x)
Returns the slope of the regression line
REGR_SXX(y, x)
Returns REG_COUNT (y, x) * VAR_POP(x)
REGR_SXY(y, x)
Returns REG_COUNT (y, x) * COVAR_POP(y, x)
REGR_SYY(y, x)
Returns REG_COUNT (y, x) * VAR_POP (y)
REMAINDER(n1, n2)
Identifies the multiple of n2 that is nearest to n1, and returns the difference between those two values.
Does the string replacement
Returns a row containing a subtotal
ROUND(d[, fmt])
d rounded on fmt (the default for fmt is midnight)
Returns the number rounded to nearest value, adjusts precision.
row number for ranking
Converts the ROWID x to a VARCHAR2 string.
Converts the ROWID x to an NVARCHAR2 string.
pseudo-column and is calculated as rows are retrieved
Adds a specified set of characters to the right of the original string.
Removes a set of characters from the right of a string.
Returns the database session time zone
Returns 1 If The Argument Is Positive; -1 If The Argument Is Negative; And 0 If The Argument Is Negative.
SIN(n)
Sine of n (n expressed in radians)
SINH(n)
Hyperbolic sine of n
Converts a string to a code value based on similar sounds.
Sqrt(x)
Square Root Of x
Returns the standard deviation
Concatenates two strings.
Retrieves a portion.
Returns the sum
Converts the TIMESTAMP WITH TIMEZONE x to a TIMESTAMP in UTC.
Extracts the UTC from a datetime value.
Returns the current operating system date from database server
Returns a TIMESTAMP WITH TIME ZONE for the database.
TAN(n)
Tangent of n (n expressed in radians)
TANH(n)
Hyperbolic tangent of n
Converts x to a BINARY_DOUBLE.
Converts x to a BINARY_FLOAT.
Converts x to a binary large object (BLOB).
Converts number and date value to string and format
Converts x to a character large object (CLOB). A CLOBis used to store large amounts of character data.
Converts string to date value
Converts the string x to an INTERVAL DAY TO SECOND.
Converts string x to INTERVAL DAY TO SECOND.
Converts the single-byte characters in x to the corresponding multi-byte characters.
Converts x in the database character set to an NVARCHAR2 string.
Converts x to a large object NCLOB.
Converts x to a NUMBER.
Converts the multi-byte characters in x to the corresponding single-byte characters.
Converts the string x to a TIMESTAMP.
TO_TIMESTAMP(x, [format])
Converts the string x to a TIMESTAMP.
Converts the string xto a TIMESTAMP WITH TIME ZONE.
TO_TIMESTAMP_TZ(x, [format])
Converts the string x to a TIMESTAMP WITH TIMEZONE.
Converts the string x to an INTERVAL YEAR TO MONTH.
Converts string x to INTERVAL YEAR TO MONTH.
Converts all occurrences of from_string in x to to_string.
Replaces a string character by character.
Removes a set of characters from both sides.
TRUNC(d[, fmt])
d truncated on fmt (the default for fmt is midnight)
Returns the truncated value (removes decimal part of a number, precision adjustable).
TZ_OFFSET(time_zone)
Returns the offset for time_zone in hours and minutes
Converts the characters in x to an NCHAR character.
Converts every letter to uppercase.
Returns the variance
Returns the storage size.