/  130
 
PL-SQL Functions
Comparison OperatorsTable 1-1. Comparison OperatorsOperatorWhat it does
=true if two expressions are equal!= ^= -= <>logically equivalent—true if two expressions are not equal>
 
True if left expression is greater than right expression>=True if left expression is greater than or equal to right expression<True if left expression is less than right expression<=True if left expression is less than or equal to right expressionINIs equal to any member of a set or subqueryNOT INDoes NOT equal any member of a set or subqueryANY, SOMETrue if one or more of the values in the list of expressions or subquery satisfies theconditionALLTrue if all of the values in the list of expressions or subquery satisfies the conditionBETWEEN
 x 
AND
True if greater than or equal to
 x 
and less than or equal to
(can be reversed inmeaning with NOT)EXISTSTrue if the subquery returns at least one row (can be reversed in meaning with NOT)LIKE
 pattern
[ESCAPE '
']'True if expression or subquery matches
 pattern
. '%' matches any sequence of characters, '_' matches any single character. If ESCAPE is used, the character '
' causesthe character following to be taken literally (can be reversed in meaning with NOT).IS NULLTRUE if the value is NULL (can be reversed in meaning with NOT)
Select Operators
Also called
SET 
operators
1
 
Table 1-2. Select Operators (Sets)OperatorWhat it does
UNIONThis combines the results of two queries and returns the set odistinct rows returned by either queryUNION ALLThis combines the results of two queries and returns all rowsreturned by either query, including duplicatesINTERSECTThis combines the results of two queries and returns the set of distinct rows returned by both queriesMINUSThis combines the results of two queries and returns the distinctrows that were in the first query, but not in the second
Table 1-3. Other Select OperatorsOperatorWhat it does
(+)Denotes that the preceding column is an outer join*Wildcard operator. Equals all columns in a select statementPRIORDenotes a parent-child relationship in a tree-structured queryALLInclude all duplicate rows in a query (the default)DISTINCTEliminate duplicates in a result set
Single Row FunctionsNumber FunctionsTable 1-6. Single Row Number FunctionsFunctionWhat it does
 
ABS(
n
)Returns absolute value o
n
ACOS(
n
)Returns arc cosine o
n
in radiansASIN(
n
)Returns arc sine o
n
in radiansATAN(
n
)Returns arc tangent o
n
, in radiansATAN2(
n,m
)Returns the arc tangent o
n
and
m
, in radiansBITAND(
n,m
)Computes the bitwise logical AND of the bits o
n
and
m
, where
n
and
m
are nonnegative integers. Returns aninteger.CEIL(
n
)Ceiling functionreturns the smallest integer >=
n
COS(
n
)Returns the cosine o
n
where
n
is in radiansCOSH(
n
)Returns the hyperbolic cosine o
n
where
n
is in radiansEXP(
n
)Returns e
n
FLOOR(
n
)Returns the largest integer <=
n
LN(
n
)Returns the natural log o
n
LOG(
m,n
)Returns the base
m
log of 
n
2
 
FunctionWhat it does
MOD(
m,n
)Returns the modulus o
m, n
—the remainder of 
m
divided by
n.
(Returns
m
when
n
=0)POWER(
m,n
)Returns
m
raised to the
n
th
powerROUND (
m
[,
n
])Rounds
m
to the nearest
n
places. Where
n
is omitted,default is zero.
n
must be an integerSIGN(
n
)For
n
< 0, returns –1, for
n
> 0, returns 1, for
n
= 0,returns 0SIN(
n
)Returns sine(
n
) where
n
is in radiansSINH(
n
)Returns the hyperbolic sine(
n
) where
n
is in radiansSQRT(
n
)Returns the square root o
n
TAN(
n
)Returns the tangent(
n
) where
n
is in radiansTANH(
n
)Returns the hyperbolic tangent(
n
) where
n
is in radiansTRUNC (
m
[,
n
])Truncate. Returns
m
truncated to
n
places. Where
n
isomitted, it returns the integer value of 
m.
WIDTH_BUCKET(
exp,min,max,num)
Returns the “bucket” in which
exp
belongs, where
min
isthe minimum value,
max 
is the maximum value, and
num
is the number of divisions (buckets) to use
Character FunctionsTable 1-7. Character Single Row FunctionsFunctionWhat it does
CHR (
n
)Returns the character whose binary value is
n.
Accepts USING NCHAR_CS clauseCONCAT (
char1,char2
)Combines two strings,
char1
and
char2
INITCAP(
char 
)Returns
char 
with the first character of eachword in
char 
capitalizedLOWER(
char 
)Returns
char 
with all characters converted tolowercaseLPAD(
char1,n[,char2])
Returns
char1
padded on the left to width
n
with character sequence in
char2
. Defaultpadding is a single blank (space).LTRIM(
char[,set]
)Returns
char 
with initial characters in
set 
removed from the left. Default
set 
is a blankcharacter (space).NLS_INITCAP(
char[,nlsparam]
)Returns
char 
with the first character of eachword in
char 
capitalized. Accepts an NLSparameter.NLS_LOWER(
char[,nlsparam]
)Returns
char 
with all characters converted tolowercase. Accepts an NLS parameter.NLSSORT(
char[,nlsparam]
)Returns language specific sort o
char.
Acceptsan NLS parameter.NLS_UPPER(
char[,nlsparam]
)Returns
char 
with all characters converted touppercase. Accepts an NLS parameter.
3

Share & Embed

More from this user

Recent Readcasters

Add a Comment

Characters: ...

Sangeeth Kannanleft a comment

thanks a lot

uneedbalajileft a comment

Thanks a lot dear it helped me lot