Oracle® Database SQL Language Reference 11g Release 2 (11.2) Part Number E17118-04 |
|
|
PDF · Mobi · ePub |
Single-row functions return a single result row for every row of a queried table or view. These functions can appear in select lists, WHERE
clauses, START
WITH
and CONNECT
BY
clauses, and HAVING
clauses.
Numeric functions accept numeric input and return numeric values. Most numeric functions return NUMBER
values that are accurate to 38 decimal digits. The transcendental functions COS
, COSH
, EXP
, LN
, LOG
, SIN
, SINH
, SQRT
, TAN
, and TANH
are accurate to 36 decimal digits. The transcendental functions ACOS
, ASIN
, ATAN
, and ATAN2
are accurate to 30 decimal digits. The numeric functions are:
Character functions that return character values return values of the following data types unless otherwise documented:
If the input argument is CHAR
or VARCHAR2
, then the value returned is VARCHAR2
.
If the input argument is NCHAR
or NVARCHAR2
, then the value returned is NVARCHAR2
.
The length of the value returned by the function is limited by the maximum length of the data type returned.
For functions that return CHAR
or VARCHAR2
, if the length of the return value exceeds the limit, then Oracle Database truncates it and returns the result without an error message.
For functions that return CLOB
values, if the length of the return values exceeds the limit, then Oracle raises an error and returns no data.
The character functions that return character values are:
Character functions that return number values can take as their argument any character data type. The character functions that return number values are:
The NLS character functions return information about the character set. The NLS character functions are:
Datetime functions operate on date (DATE
), timestamp (TIMESTAMP
, TIMESTAMP
WITH
TIME
ZONE
, and TIMESTAMP
WITH
LOCAL
TIME
ZONE
), and interval (INTERVAL
DAY
TO
SECOND
, INTERVAL
YEAR
TO
MONTH
) values.
Some of the datetime functions were designed for the Oracle DATE
data type (ADD_MONTHS
, CURRENT_DATE
, LAST_DAY
, NEW_TIME
, and NEXT_DAY
). If you provide a timestamp value as their argument, then Oracle Database internally converts the input type to a DATE
value and returns a DATE
value. The exceptions are the MONTHS_BETWEEN
function, which returns a number, and the ROUND
and TRUNC
functions, which do not accept timestamp or interval values at all.
The remaining datetime functions were designed to accept any of the three types of data (date, timestamp, and interval) and to return a value of one of these types.
All of the datetime functions that return current system datetime information, such as SYSDATE
, SYSTIMESTAMP
, CURRENT_TIMESTAMP
, and so forth, are evaluated once for each SQL statement, regardless how many times they are referenced in that statement.
The datetime functions are:
The general comparison functions determine the greatest and or least value from a set of values. The general comparison functions are:
Conversion functions convert a value from one data type to another. Generally, the form of the function names follows the convention datatype
TO
datatype
. The first data type is the input data type. The second data type is the output data type. The SQL conversion functions are:
The large object functions operate on LOBs. The large object functions are:
The collection functions operate on nested tables and varrays. The SQL collection functions are:
Hierarchical functions applies hierarchical path information to a result set. The hierarchical function is:
The data mining functions operate on models that have been built using the DBMS_DATA_MINING
package or the Oracle Data Mining Java API. The SQL data mining functions are:
See Also:
Oracle Data Mining Application Developer's Guide for information on SQL data mining functionsThe XML functions operate on or return XML documents or fragments. These functions use arguments that are not defined as part of the ANSI/ISO/IEC SQL Standard but are defined as part of the World Wide Web Consortium (W3C) standards. The processing and operations that the functions perform are defined by the relevant W3C standards. The table below provides a link to the appropriate section of the W3C standard for the rules and guidelines that apply to each of these XML-related arguments. A SQL statement that uses one of these XML functions, where any of the arguments does not conform to the relevant W3C syntax, will result in an error. Of special note is the fact that not every character that is allowed in the value of a database column is considered legal in XML.
Syntax Element | W3C Standard URL |
---|---|
value_expr |
http://www.w3.org/TR/2006/REC-xml-20060816 |
Xpath_string |
http://www.w3.org/TR/1999/REC-xpath-19991116 |
XQuery_string |
http://www.w3.org/TR/2007/REC-xquery-semantics-20070123/ |
namespace_string |
http://www.w3.org/TR/2006/REC-xml-names-20060816/ |
identifier |
http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Nmtoken |
For more information about selecting and querying XML data using these functions, including information on formatting output, refer to Oracle XML DB Developer's Guide.
The SQL XML functions are:
The encoding and decoding functions let you inspect and decode data in the database. The encoding and decoding functions are:
The NULL
-related functions facilitate null handling. The NULL
-related functions are:
The environment and identifier functions provide information about the instance and session. The environment and identifier functions are: