Thursday, July 14, 2011

Oracle Built-in Functions

Oracle Built-in Functions
Version 11.1
 
Function Name
AnalyticCollectionConver
sion
Date
Time
Data MiningMisc.Model
Clause
Null
Handling
NumericObjectStringXML
ABS           
ACOS           
ADD_MONTHS           
ADJ_DATE           
APPENDCHILDXML           
ASCII           
ASCIISTR           
ASIN           
ATAN           
ATAN2           
AVG          
BFILENAME           
BIN_TO_NUM           
BINARY2VARCHAR           
BIT_COMPLEMENT           
BIT_OR           
BIT_XOR           
BITAND           
BOOL_TO_INT           
CARDINALITY           
CASE         
CAST           
CAST_FROM_BINARY
_DOUBLE
           
CAST_FROM_BINARY
_FLOAT
           
CAST_FROM_BINARY
_INTEGER
           
CAST_FROM_NUMBER           
CAST_TO_BINARY
_DOUBLE
           
CAST_TO_BINARY_FLOAT           
CAST_TO_BINARY
_INTEGER
           
CAST_TO_NUMBER           
CAST_TO_NVARCHAR2           
CAST_TO_RAW           
CAST_TO_VARCHAR           
CEIL           
CHARTOROWID           
CHR           
CLUSTER_ID           
CLUSTER_PROBABILITY           
CLUSTER_SET           
COALESCE          
COLLECT           
COMPOSE           
CONCAT          
CONVERT          
CORR          
CORR_K           
CORR_S           
COS           
COSH           
COUNT          
COVAR_POP          
COVAR_SAMP          
CUME_DIST          
CURRENT_DATE           
CURRENT_TIMESTAMP           
CV           
DBTIMEZONE           
DENSE_RANK          
DECODE         
DECOMPOSE           
DELETEXML           
DEPTH           
DEREF           
DUMP         
EMPTY_BLOB (large object)           
EMPTY_CLOB (large object)           
ESTIMATE_CPU_UNITS           
EXISTSNODE           
EXP           
EXTRACT          
EXTRACTVALUE           
FEATURE_ID           
FEATURE_SET           
FEATURE_VALUE           
FIRST          
FIRST_VALUE           
FLOOR           
FROM_TZ           
GET_CLOCK_TIME           
GET_DDL           
GET_DEPENDENT_DDL           
GET_DEPENDENT_XML           
GET_GRANTED_DDL           
GET_GRANTED_XDL           
GET_HASH           
GET_REBUILD_COMMAND           
GET_SCN           
GET_XML           
GREATEST          
GROUP_ID           
GROUPING           
GROUPING_ID           
HEXTORAW           
INITCAP           
INSERTCHILDXML           
INSERTXMLBEFORE           
INSTR           
INSTRB           
INSTRC           
INSTR2           
INSTR4           
INT_TO_BOOL           
INTERVAL           
ITERATE           
ITERATE UNTIL           
ITERATION_NUMBER           
LAG           
LAST           
LAST_DAY           
LAST_VALUE           
LEAD           
LEAST          
LENGTH        
LENGTHB         
LENGTHC         
LENGTH2         
LENGTH4         
LN           
LNNVL           
LOCALTIMESTAMP           
LOG           
LOWER           
LPAD           
LTRIM           
MAKEREF           
MAX        
MEDIAN           
MIN        
MONTHS_BETWEEN           
MOD           
NANVL           
NEW_TIME           
NEXT_DAY           
NHEXTORAW           
NLS_CHARSET_DECL_LEN           
NLS_CHARSET_ID           
NLS_CHARSET_NAME           
NLS_INITCAP           
NLS_LOWER           
NLSSORT           
NLS_UPPER           
NTILE           
NULLFN             
NULLIF           
NUMTODSINTERVAL           
NUMTOHEX  &         
NUMTOHEX2           
NUMTOYMINTERVAL           
NVL           
NVL2           
ORA_HASH           
PATH           
PERCENT_RANK          
PERCENTILE_CONT          
PERCENTILE_DISC          
POWER           
POWERMULTISET           
POWERMULTISET_BY_
CARDINALITY
           
PREDICTION           
PREDICTION_BOUNDS           
PREDICTION_COST           
PREDICTION_DETAILS           
PREDICTION_PROBABILITY           
PREDICTION_SET           
PRESENTNNV           
PRESENTV           
PREVIOUS           
QUOTE DELIMITERS           
RANDOMBYTES           
RANDOMINTEGER           
RANDOMNUMBER           
RANK          
RATIO_TO_REPORT           
RAW_TO_CHAR           
RAW_TO_NCHAR           
RAW_TO_VARCHAR2           
RAWTOHEX           
RAWTONHEX           
RAWTONUM           
RAWTONUM2           
REF           
REFTOHEX           
REGEXP_COUNT           
REGEXP_INSTR           
REGEXP_REPLACE           
REGEXP_SUBSTR           
REGR_AVGX          
REGR_AVGY          
REGR_COUNT          
REGR_INTERCEPT          
REGR_R2          
REGR_SLOPE          
REGR_SXX          
REGR_SXY          
REGR_SYY          
REMAINDER           
REPLACE           
REVERSE          
ROUND          
ROW_NUMBER           
ROWIDTOCHAR           
ROWIDTONCHAR           
RPAD           
RTRIM           
SCN_TO_TIMESTAMP           
SESSIONTIMEZONE           
SET           
SIGN           
SIN           
SINH           
SOUNDEX           
SQRT           
SQLCODE (exception)           
SQLERRM (exception)           
STATS_BINOMIAL_TEST           
STATS_CROSSTAB           
STATS_F_TEST           
STATS_KS_TEST           
STATS_MODE           
STATS_MW_TEST           
STATS_ONE_WAY_ANOVA           
STATS_T_TEST           
STATS_WSR_TEST           
STDDEV          
STDDEV_POP           
STDDEV_SAMP           
STRING_TO_RAW           
SUBSTR          
SUBSTRB           
SUBSTRC           
SUBSTR2           
SUBSTR4           
SUM          
SYS_CONNECT_BY_PATH (hierarchical)           
SYS_CONTEXT (environment)           
SYS_DBURIGEN           
SYS_EXTRACT_UTC           
SYS_GUID (identifier)           
SYS_OP_COMBINED_HASH           
SYS_OP_DESCEND           
SYS_OP_DISTINCT         
SYS_OP_GUID           
SYS_OP_LBID           
SYS_OP_MAP_NONNULL           
SYS_OP_RAWTONUM           
SYS_OP_RPB           
SYS_OP_TOSETID           
SYS_TYPEID           
SYS_XMLAGG           
SYS_XMLGEN           
SYSDATE           
SYSTIMESTAMP           
TABLE           
TAN           
TANH           
TIMESTAMP_TO_SCN           
TO_BINARYDOUBLE           
TO_BINARYFLOAT           
TO_CHAR           
TO_CLOB           
TO_DATE           
TO_DSINTERVAL           
TO_LOB           
TO_MULTI_BYTE           
TO_NCHAR           
TO_NCLOB           
TO_NUMBER           
TO_SINGLE_BYTE           
TO_TIMESTAMP           
TO_TIMESTAMP_TZ           
TO_YMINTERVAL           
TRANSLATE          
TRANSLATE USING          
TRANSLITERATE           
TREAT           
TRIM           
TRUNC          
TZ_OFFSET           
UID (environment)           
UNISTR           
UPDATEXML           
UPPER           
USER (environment)           
USERENV  (environment)           
VALUE (object)           
VAR_POP          
VAR_SAMP          
VARIANCE          
VERIFY_OWNER           
VERIFY_TABLE           
VERTICAL BARS           
VSIZE         
WIDTH_BUCKET           
XMLAGG           
XMLCAST           
XMLCDATA           
XMLCOLLATVAL           
XMLCOMMENT           
XMLCONCAT           
XMLDIFF           
XMLELEMENT           
XMLEXISTS           
XMLFOREST           
XMLISVALID           
XMLPARSE           
XMLPATCH           
XMLPI           
XMLQUERY           
XMLROOT           
XMLSEQUENCE           
XMLSERIALIZE           
XMLTABLE           
XMLTRANSFORM           
XOR          

Oracle SUBSTR & INSTR Functions

Oracle SUBSTR & INSTR Functions
Version 11.1
SUBSTR (Substring) Built-in String Function
SUBSTR (overload 1)SUBSTR(
STR1 VARCHAR2 CHARACTER SET ANY_CS,
POS  PLS_INTEGER,                -- starting position
LEN  PLS_INTEGER := 2147483647)  -- number of characters
RETURN VARCHAR2 CHARACTER SET STR1%CHARSET;
SUBSTR (overload 2)SUBSTR(
STR1 CLOB CHARACTER SET ANY_CS,
POS  NUMBER,                -- starting position
LEN  NUMBER := 2147483647)  -- number of characters
RETURN CLOB CHARACTER SET STR1%CHARSET;
Substring Beginning Of StringSELECT SUBSTR(<value>, 1, <number_of_characters>)
FROM DUAL;
SELECT SUBSTR('Take the first four characters', 1, 4) FIRST_FOUR
FROM DUAL;
Substring Middle Of StringSELECT SUBSTR(<value>, <starting_position>, <number_of_characters>)
FROM DUAL.
SELECT SUBSTR('Take the first four characters', 164) MIDDLE_FOUR
FROM DUAL;

Substring End of String
SELECT SUBSTR(<value>, <starting_position>)
FROM DUAL;
SELECT SUBSTR('Take the first four characters', 16) SIXTEEN_TO_END
FROM DUAL;

SELECT SUBSTR('Take the first four characters', -4) FINAL_FOUR
FROM DUAL;
Simplified Examples
Examples in Oracle/PLSQL of using the substr() function to extract a substring from a string:The general syntax for the SUBSTR() function is:
    SUBSTR( source_string, start_position, [ length ] )
"source_string" is the original source_string that the substring will be taken from.
"start_position" is the position in the source_string where you want to start extracting characters. The first position in the string is always '1', NOT '0', as in many other languages.
"length" is an optional parameter that specifies how many characters to extract. If this parameter is not used, SUBSTR will return everything from the start_position to the end of the string.
Notes:
If the start_position is specified as "0", substr treats start_position as "1", that is, as the first position in the string.
If the start_position is a positive number, then substr starts from the beginning of the string.
If the start_position is a negative number, then substr starts from the end of the string and counts backwards.
If the length is a negative number, then substr will return a NULL value.
Examples:



    substr('Dinner starts in one hour.', 8, 6)    will return 'starts'
    substr('Dinner starts in one hour.', 8)       will return 'starts in one hour.'
    substr('Dinner starts in one hour.', 1, 6)    will return 'Dinner'
    substr('Dinner starts in one hour.', 0, 6)    will return 'Dinner'
    substr('Dinner starts in one hour.', -4, 3)   will return 'our'
    substr('Dinner starts in one hour.', -9, 3)   will return 'one'
    substr('Dinner starts in one hour.', -9, 2)   will return 'on'
This function works identically in Oracle 8i, Oracle 9i, Oracle 10g, and Oracle 11g.
INSTR (Instring) Built-in String Function
INSTR (overload 1)INSTR(
STR1 VARCHAR2 CHARACTER SET ANY_CS,        -- test string
STR2 VARCHAR2 CHARACTER SET STR1%CHARSET,  -- string to locate
POS  PLS_INTEGER := 1,                     -- position
NTH  POSITIVE := 1)                        -- occurrence number
RETURN PLS_INTEGER;
INSTR (overload 2)INSTR(
STR1 CLOB CHARACTER SET ANY_CS,            -- test string
STR2 CLOB CHARACTER SET STR1%CHARSET,      -- string to locate
POS  INTEGER := 1,                         -- position
NTH  POSITIVE := 1)                        -- occurrence number
RETURN INTEGER;
Instring For Matching First Value FoundSELECT INSTR(<value>, <value_to_match>, <direction>, <instance>
FROM DUAL;
SELECT INSTR('Take the first four characters', 'a', 1, 1) FOUND_1
FROM DUAL;
Instring If No Matching Second Value FoundSELECT INSTR('Take the first four characters', 'a', 1, 2) FOUND_2
FROM DUAL;
Instring For Multiple
Characters
SELECT INSTR('Take the first four characters', 'four', 1, 1) MCHARS
FROM DUAL;
Reverse Direction SearchSELECT INSTR('Take the first four characters', 'a', -1, 1) REV_SRCH
FROM DUAL;
Reverse Direction Search Second MatchSELECT INSTR('Take the first four characters', 'a', -1, 2) REV_TWO
FROM DUAL;
String Parsing By Combining SUBSTR And INSTR Built-in String Functions
List parsing first value

Take up to the character before the first comma
SELECT SUBSTR('abc,def,ghi', 1 ,INSTR('abc,def,ghi', ',', 1, 1)-1)
FROM DUAL;
List parsing center value

Take the value between the commas
SELECT SUBSTR('abc,def,ghi', INSTR('abc,def,ghi',',', 1, 1)+1,
INSTR('abc,def,ghi',',',1,2)-INSTR('abc,def,ghi',',',1,1)-1)
FROM DUAL;
List parsing last value

Take the value after the last comma
SELECT SUBSTR('abc,def,ghi', INSTR('abc,def,ghi',',', -1, 1)+1)
FROM DUAL;
Related Topics
DBMS_LOB Built-in Package
Regular Expressions
String Functions

Extended Function Support in RTF

http://www.scribd.com/doc/55608807/64/XSL-Equivalents

http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/e12187/T421739T481158.htm

Extended Function Support in RTF Templates


Extended Function Support in RTF Templates

Extended SQL and XSL Functions

BI Publisher has extended a set of SQL and XSL functions for use in RTF templates. The syntax for these extended functions is
<?xdofx:expression?>
for extended SQL functions or
<?xdoxslt:expression?>
for extended XSL functions.
Note: You cannot mix xdofx statements with XSL expressions in the same context. For example, assume you had two elements, FIRST_NAME and LAST_NAME that you wanted to concatenate into a 30-character field and right pad the field with the character "x", you could NOT use the following:
INCORRECT:
<?xdofx:rpad(concat(FIRST_NAME,LAST_NAME),30, 'x')?>
because concat is an XSL expression. Instead, you could use the following:
CORRECT:
<?xdofx:rpad(FIRST_NAME||LAST_NAME),30,'x')?>
The supported functions are shown in the following table:
SQL Statement or XSL ExpressionUsageDescription
2+3<?xdofx:2+3?>Addition
2-3<?xdofx:2-3?>Subtraction
2*3<?xdofx:2*3?>Multiplication
2/3<?xdofx:2/3?>Division
2**3<?xdofx:2**3?>Exponential
3||2<?xdofx:3||2?>Concatenation
lpad('aaa',10,'.')<?xdofx:lpad('aaa',10,'.')?>The lpad function pads the left side of a string with a specific set of characters. The syntax for the lpad function is: 
lpad(string1,padded_length,[pad_string]
string1 is the string to pad characters to (the left-hand side). 
padded_length is the number of characters to return. 
pad_string is the string that will be padded to the left-hand side of string1 .
rpad('aaa',10,'.')<?xdofx:rpad('aaa',10,'.')?>The rpad function pads the right side of a string with a specific set of characters. 
The syntax for the rpad function is: 
rpad(string1,padded_length,[pad_string]). 
string1 is the string to pad characters to (the right-hand side). 
padded_length is the number of characters to return. 
pad_string is the string that will be padded to the right-hand side of string1
trim()<?xdoxslt:trim(‘ a ‘)?>Removes spaces in a string. Enter the text to be trimmed, the function returns the trimmed text.
ltrim()<?xdoxslt:ltrim(‘ a ‘)?>Removes the leading white spaces in a string.
rtrim()<?xdoxslt:rtrim(‘ a ‘)?>Removes the trailing white spaces in a string.
truncate<?xdoxslt:truncate ( number [, integer ] )?>The truncate function returns number truncated to integer places right of the decimal point. If integer is omitted, then number is truncated to the whole integer value. integer can be negative to truncate values left of the decimal point. integer must be an integer.
Example:
<?xdoxslt:truncate(-2.3333)?>
returns
-2
Example:
<?xdoxslt:truncate(2.7777, 2)?>
returns
2.77
Example:
<?xdoxslt:truncate(27.7777, -1)?>
returns
20
replicate<?xdoxslt:replicate(‘string’, integer)?>The replicate function will replicate the specified string the specified number of times.
Example:
<?xdoxslt:replicate(‘oracle’, 3)?>
returns
oracleoracleoracle
decode('xxx','bbb','ccc','xxx','ddd')<?xdofx:decode('xxx','bbb','ccc','xxx','ddd')?>The decode function has the functionality of an IF-THEN-ELSE statement. The syntax for the decode function is: 
decode(expression, search, result [,search, result]...[, default]) 
expression is the value to compare. 
search is the value that is compared against expression. 
result is the value returned, if expression is equal to search. 
default is returned if no matches are found.
Instr('abcabcabc','a',2)<?xdofx:Instr('abcabcabc','a',2)?>The instr function returns the location of a substring in a string. The syntax for the instr function is: 
instr(string1,string2,[start_position],[nth_appearance]) 
string1 is the string to search. 
string2 is the substring to search for in string1. 
start_position is the position in string1 where the search will start. The first position in the string is 1. If the start_position is negative, the function counts back start_position number of characters from the end of string1 and then searches towards the beginning of string1. 
nth appearance is the nth appearance of string2.
substr('abcdefg',2,3)<?xdofx:substr('abcdefg',2,3)?>The substr function allows you to extract a substring from a string. The syntax for the substr function is: 
substr(string, start_position, length) 
string is the source string. 
start_position is the position for extraction. The first position in the string is always 1. 
length is the number of characters to extract.
left<?xdoxslt:left(‘abcdefg’, 3)?>Enables you to extract the specified number of characters from a string, starting from the left. The syntax is left(string, Numchars)
For example, <?xdoxslt:left(‘abcdefg’, 3)?>
returns
abc
right<?xdoxslt:right(‘abcdefg’, 3)?>Enables you to extract the specified number of characters from a string, starting from the right. The syntax is right(string, Numchars) 
For example, <?xdoxslt:right(‘abcdefg’, 3)?>
returns
efg
replace(name,'John','Jon')<?xdofx:replace(name,'John','Jon')?>The replace function replaces a sequence of characters in a string with another set of characters. The syntax for the replace function is: 
replace(string1,string_to_replace,[replacement_string]) 
string1 is the string to replace a sequence of characters with another set of characters. 
string_to_replace is the string that will be searched for in string1. 
replacement_string is optional. All occurrences of string_to_replace will be replaced with replacement_string in string1.
to_number('12345')<?xdofx:to_number('12345')?>Function to_number converts char, a value of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype containing a number in the format specified by the optional format model fmt, to a value of NUMBER datatype.
format_number<?xdoxslt:format_number(12345, n, $_XDOLOCALE)?>Converts a number to a string and formats the number according to the locale specified in $_XDOLOCALE and to the number of decimal positions specified in n using Java's default symbols. For example: 
<?xdoxslt:format_number(-12345, 2, ‘fr-FR’)?> 
returns
-12 345,00
format_number<?xdoxslt:format_number(12345, ns1,s2,$_XDOLOCALE)?>Converts a number to a string and uses the specified separators: s1 for the thousand separator and s2 for the decimal separator. For example:
<?xdoxslt:format_number(12345, 2, 'g', 'd', $_XDOLOCALE)?> returns
12g345d00
pat_format_number<?xdoxslt:pat_format_number(12345, ‘##,##0.00’, $_XDOLOCALE)?>Returns a number formatted with the specified pattern.
For example:
<?xdoxslt:pat_format_number(12345, ‘##,##0.00’, $_XDOLOCALE)?>
returns
12,345.00
to_char(12345)<?xdofx:to_char('12345')?>Use the TO_CHAR function to translate a value of NUMBER datatype to VARCHAR2 datatype.
to_date<?xdofx:to_date ( char [, fmt [, 'nlsparam']] )TO_DATE converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to a value of DATE datatype. The fmt is a date format specifying the format of char. If you omit fmt, then char must be in the default date format. If fmt is 'J', for Julian, thenchar must be an integer.
sysdate()<?xdofx:sysdate()?>SYSDATE returns the current date and time. The datatype of the returned value is DATE. The function requires no arguments.
current_date()<?xdoxslt:current_date($_XDOLOCALE, $_XDOTIMEZONE)?>
Example: <?xdoxslt:current_date('ja-JP', 'Asia/Tokyo')?>
Returns the current date in "yyyy-MM-dd" format in the given locale and timezone. This function supports only the Gregorian calendar.
current_time()<?xdoxslt:current_time($_XDOLOCALE, $_XDOTIMEZONE)?>
Example:
<?xdoxslt:current_time('ja-JP', 'Asia/Tokyo')?>
Returns the current time in the given locale and timezone. This function supports only the Gregorian calendar.
minimum<?xdoxslt:minimum(ELEMENT_NAME)?>Returns the minimum value of the element in the set.
date_diff<?xdoxslt:date_diff(‘y', ‘YYYY-MM-DD’, ‘YYYY-MM-DD’, $_XDOLOCALE, $_XDOTIMEZONE)?>This function provides a method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only the Gregorian calendar. The syntax is as follows:
<?xdoxslt:date_diff(‘format’, ‘YYYY-MM-DD’, ‘YYYY-MM-DD’, $_XDOLOCALE, $_XDOTIMEZONE)?>
where
format is the time value for which the difference is to be calculated. Valid values are :
  • y - for year
  • m - for month
  • w - for week
  • d - for day
  • h - for hour
  • mi - for minute
  • s - for seconds
  • ms - for milliseconds

Example:
<?xdoxslt:date_diff(‘y’, ‘2000-04-08’, ‘2001-05-01’, $_XDOLOCALE, $_XDOTIMEZONE)?>
returns
1
Example:
<?xdoxslt:date_diff(‘m’, ‘2001-04-08’, ‘2000-02-01’, $_XDOLOCALE, $_XDOTIMEZONE)?>
returns
-14
Example:
<?xdoxslt:date_diff(‘d’, ‘2006-04-08’, ‘2006-04-01’, $_XDOLOCALE, ‘America/Los_Angeles’)?>
returns
-7
sec_diff<?xdoxslt:sec_diff(‘2000-04-08T20:00:00’, ‘2000-04-08T21:00:00’, $_XDOLOCALE, $_XDOTIMEZONE?>This function provides a method to get the difference between two dates in seconds in the given locale. The dates need to be in "yyyy-MM-dd'T'HH:mm:ss". This function supports only Gregorian calendar.
Example:
<?xdoxslt:sec_diff(‘2000-04-08T20:00:00’, ‘2000-04-08T21:00:00’, $_XDOLOCALE, $_XDOTIMEZONE?>
returns
3600
get_day<?xdoxslt:get_day(‘2000-04-08’, $_XDOLOCALE)?>This function provides a method to get the day value of a date in "yyyy-MM-dd" format in the given locale. This function supports only the Gregorian calendar. 
Example:
<?xdoxslt:get_day(‘2000-04-08’, $_XDOLOCALE)?>
returns
8
get_month<?xdoxslt:get_month(‘2000-04-08’, $_XDOLOCALE)?>This function provides a method to get the month value of a date in "yyyy-MM-dd" format in the given locale. This function supports only the Gregorian calendar. 
Example:
<?xdoxslt:get_month(‘2000-04-08’, $_XDOLOCALE)?>
returns
4
get_year<?xdoxslt:get_year(‘2000-04-08’, $_XDOLOCALE)?>This function provides a method to get the year value of a date in "yyyy-MM-dd" format in the given locale. This function supports only the Gregorian calendar. 
Example:
<?xdoxslt:get_year(‘2000-04-08’, $_XDOLOCALE)?>
returns
2000
month_name<?xdoxslt:month_name(1, 0, $_XDOLOCALE)?>This function provides a method to get the name of the month in the given locale. This function supports only the Gregorian calendar. 
The syntax for this function is:
<?xdoxslt:month_name(month, [abbreviate?], $_XDOLOCALE)?>
where 
month is the numeric value of the month (Januany = 1)
and
[abbreviate?] is the value 0 for do not abbreviate or 1 for abbreviate.
Example:
<?xdoxslt:month_name(12, 1, ‘fr-FR’)?>
returns
dec.
Example"
<?xdoxslt:month_name(1, 0, $_XDOLOCALE)?>
returns
January
maximum<?xdoxslt:maximum(ELEMENT_NAME)?>Returns the maximum value of the element in the set.
abs<?xdoxslt:abs(-123.45)?>Returns the absolute value of the number entered.
Example:
<?xdoxslt:abs(-123.45)?>
Returns:
123.45
chr<?xdofx:chr(n)?>CHR returns the character having the binary equivalent to n in either the database character set or the national character set.
ceil<?xdofx:ceil(n)?>CEIL returns smallest integer greater than or equal to n.
floor<?xdofx:floor(n)?>FLOOR returns largest integer equal to or less than n.
round
(SQL function)
<?xdofx:round ( number [, integer ] )?>ROUND returns number rounded to integer places right of the decimal point. If integer is omitted, then number is rounded to 0 places. integer can be negative to round off digits left of the decimal point. integer must be an integer.
Example:
<?xdofx:round (2.777)?>
returns
3
Example:
<?xdofx:round (2.777, 2)?>
returns 
2.78
round
(XSLT function)
<?xdoxslt:round ( number [, integer ] )?>ROUND returns number rounded to integer places right of the decimal point. If integer is omitted, then number is rounded to 0 places. integer can be negative to round off digits left of the decimal point. integer must be an integer.
Example:
<?xdoxslt:round (2.777)?>
returns
3
Example:
<?xdoxslt:round (2.777, 2)?>
returns 
2.78
lower<?xdofx:lower (char)?>LOWER returns char, with all letters lowercase. char can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The return value is the same datatype as char.
upper<?xdofx:upper(char)?>UPPER returns char, with all letters uppercase. char can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The return value is the same datatype as char.
length<?xdofx:length(char)?>The "length" function returns the length of char. LENGTH calculates length using characters as defined by the input character set.
greatest<?xdofx:greatest ( expr [, expr]... )?>GREATEST returns the greatest of the list of exprs. All exprs after the first are implicitly converted to the datatype of the first exprbefore the comparison.
least<?xdofx:least ( expr [, expr]... )?>LEAST returns the least of the list of exprs. All exprs after the first are implicitly converted to the datatype of the first expr before the comparison.
next_element<?xdoxslt:next_element(current-group(),.,'<element-name>')?>Method to get the next element in the current group. Will return the element that occurs after the element named. For example: 
<?xdoxslt:next_element(current-group(),.,'employee')?>
will return the element that occurs in the current group after "employee".
prev_element<?xdoxslt:prev_element(current-group(),..,'<element-name')?>Method to get the previous element in the current group. Will return the element that occurs before the element named. For example: 
<?xdoxslt:prev_element(current-group(),.,'employee')?>
will return the element that occurs in the current group before "employee".
set_array<?xdoxslt:set_array($_XDOCTX, ‘<name of hash table>’, n, ‘<value>’)?>Sets a value in a hash table. Syntax is <?xdoxslt:set_array($_XDOCTX, ‘<name of hash table>’, n, ‘<value>’)?> 
where
$_XDOCTX is required to set the context,
<name of hash table> is the name you supply for your table
n is the index of the hash table
<value> is the value to set in the hash table.
For example:
<?xdoxslt:set_array($_XDOCTX, ‘Employee’, 2, ‘Jones’)?>
See get_array below.
get_array<?xdoxslt:get_array($_XDOCTX, ‘<name of hash table>’, n)?>Returns the value at the specified index of the hash table. 
Syntax is <?xdoxslt:get_array($_XDOCTX, ‘<name of hash table>’, n)?> 
where
$_XDOCTX is required to set the context,
<name of hash table> is the name you supplied for your table in set_array
n is the index value of the element you want returned.
For example, used in conjunction with the set_array example above,
<?xdoxslt:get_array($_XDOCTX, ‘Employee’, 2)?>
returns
Jones
The following table shows supported combination functions:
SQL StatementUsage
(2+3/4-6*7)/8<?xdofx:(2+3/4-6*7)/8?>
lpad(substr('1234567890',5,3),10,'^')<?xdofx:lpad(substr('1234567890',5,3),10,'^')?>
decode('a','b','c','d','e','1')||instr('321',1,1)<?xdofx:decode('a','b','c','d','e','1')||instr('321',1,1)?>

XSL Equivalents

The following table lists the BI Publisher simplified syntax with the XSL equivalents.
Supported XSL ElementsDescriptionBI Publisher Syntax
<xsl:value-of select= "name">Placeholder syntax<?name?>
<xsl:apply-templates select="name">Applies a template rule to the current element's child nodes.<?apply:name?>
<xsl:copy-of select="name">Creates a copy of the current node.<?copy-of:name?>
<xsl:call-template name="name">Calls a named template to be inserted into/applied to the current template.<?call:name?>
<xsl:sort select="name">Sorts a group of data based on an element in the dataset.<?sort:name?>
<xsl:for-each select="name">Loops through the rows of data of a group, used to generate tabular output.<?for-each:name?>
<xsl:choose>Used in conjunction with when and otherwise to express multiple conditional tests.<?choose?>
<xsl:when test="exp">Used in conjunction with choose and otherwise to express multiple conditional tests<?when:expression?>
<xsl:otherwise>Used in conjunction with choose and when to express multiple conditional tests<?otherwise?>
<xsl:if test="exp">Used for conditional formatting.<?if:expression?>
<xsl:template name="name">Template declaration<?template:name?>
<xsl:variable name="name">Local or global variable declaration<?variable:name?>
<xsl:import href="url">Import the contents of one stylesheet into another<?import:url?>
<xsl:include href="url">Include one stylesheet in another<?include:url?>
<xsl:stylesheet xmlns:x="url">Define the root element of a stylesheet<?namespace:x=url?>

Using FO Elements

You can use most FO elements in an RTF template inside the Microsoft Word form fields. The following FO elements have been extended for use with BI Publisher RTF templates. The BI Publisher syntax can be used with either RTF template method.
The full list of FO elements supported by BI Publisher can be found in the Appendix: Supported XSL-FO Elements.
FO ElementBI Publisher Syntax
<fo:page-number-citation ref-id="id"><?fo:page-number-citation:id?>
<fo:page-number><?fo:page-number?>
<fo:ANY NAME WITHOUT ATTRIBUTE><?fo:ANY NAME WITHOUT ATTRIBUTE?>