简述oracle函数的功能,Oracle 最常用功能函数经典汇总 (zz)
来源:ChinaITLab 收集整理
2004-6-14 10:58:00
* SQL Group Function
*
s (num can be a column or ex
pression)
(null values are ign
*
ored, default between distin
ct and all is all)
********************
***************
****************************
****************
AVG([distinct or all] num)
-- average value
COUNT(distinct or all] num)
-- number of values
MAX([distinct or all
] num) -- maximum value
MAX([distinct or all] num)
-- minimum value
STDDEV([distinct or
all] num) -- standard devi
ation
SUM([distinct or all
] num) -- sum of values
VARIANCE([distinct o
r all] num) -- variance of v
alues
********************************
***********************
************************
* Miscellaneaous Functions :
*
********************
***************
****************************
****************
DECODE(expr, srch1,
return1 [,srch2, return2...]
, default]
-- if no search matches t
he expression then the default is returned,
-- otherwise,
the first search that match
es will cause
-- the corres
ponding return value to be r
eturned
DUMP(column_name [,fmt [,start_p
os [, length]]])
-- returns an
column
internal oracle format, used
for getting info about a
-- format options : 8 = oc
tal, 10 = decimel, 16 = hex, 17 = characters
-- return type
codes : 1 = varchar2, 2 = n
umber, 8 = long, 12 = date,
-- 23 = raw,
24 = long raw, 69 = rowid,
96 = char, 106 = mlslabel
GREATEST(expr [,expr2 [, expr3...]]
-- returns the largest val
ue of all expressions
LEAST(expr [,expr2 [, expr3...]]
-- returns the
smallest value of all expre
ssions
NVL(expr1 ,expr2
-- if expr1 is not null, i
t is returned, otherwise expr2 is returned
SQLCODE
-- returns sql error code
query,
of last error. Can not be used directly in
-- value must
be set to local variable fir
st
SQLERRM
-- returns sql
in query,
error message of last error
. Can not be used directly
-- value must be set to lo
cal variable first
UID
-- returns the user id of
the user you are logged on as
-- useful in s
electing information from lo
w level sys tables
USER
-- returns the
user name of the user you a
re logged on as
USERENV('option')
-- returns inf
ormation about the user you
are logged on as
-- options : E
NTRYID, SESSIONID, TERMINAL,
LANGUAGE, LABEL, OSDBA
-- (
all options not available in
all Oracle versions)
VSIZE(expr)
-- returns the number of b
ytes used by the expression
-- useful in s
electing information about t
able space requirements
********************
***************
****************************
****************
* SQL Date Functions (dt represe
*
nts oracle date and time)
* (functions return
*
an oracle date unless otherw
ise specified)
********************************
***********************
************************
ADD_MONTHS(dt, num)
-- adds num months to
dt (num can be negative)
LAST_DAY(dt)
-- last day of month in
month containing dt
MONTHS_BETWEEN(dt1, dt2) -- retu
dt2
rns fractional value of months between dt1,
NEW_TIME(dt, tz1, tz
zone 2
2) -- dt = date in time zo
ne 1, returns date in time
NEXT_DAY(dt, str) -- date
etc..)
of first (str) after dt (str = 'Monday',
SYSDATE -- present system date
ROUND(dt [,fmt] -- roun
ds dt as specified by format fmt
TRUNC(dt [,fmt]
-- truncates dt as spe
cified by format fmt
********************************
***********************
************************
* Number Functions :
*
********************************
***********************
************************
ABS(num) -- absolute
value of num
CEIL(num) -- smallest integer > or = num
COS(num) -- cosine(n
um), num in radians
COSH(num)
-- hyperbolic cosine(num)
EXP(num)
-- e raised to the num powe
r
FLOOR(num) -- largest
integer < or = num
LN(num) -- natural
logarithm of num
LOG(num2, num1) -- logarith
m base num2 of num1
MOD(num2, num1) -- remainde
r of num2 / num1
POWER(num2, num1)
-- num2 raised to the num1
power
ROUND(num1 [,num2] -- num1 rou
nded to num2 decimel places (default 0)
SIGN(num) -- sign of
num * 1, 0 if num = 0
SIN(num)
-- sin(num), num in radians
SINH(num) -- hyperbolic sine(num)
SQRT(num) -- square root of num
TAN(num) -- tangent(
num), num in radians
TANH(num)
-- hyperbolic tangent(num)
TRUNC(num1 [,num2] -- truncate
num1 to num2 decimel places (default 0)
********************************
***********************
************************
* String Functions,
*
String Result :
********************************
***********************
************************
(num) -- ASCII
character for num
CHR(num)
-- ASCII character for n
um
CONCAT(str1, str2) -- str1
concatenated with str2 (same as str1||str2)
INITCAP(str)
-- capitalize first lett
er of each word in str
LOWER(str) -- str w
ith all letters in lowercase
LPAD(str1, num [,str2]) -- left
spaces)
pad str1 to length num with str2 (default
LTRIM(str [,set])
-- remove set from left
side of str (default spaces)
NLS_INITCAP(str [,nl
s_val]) -- same as initcap f
or different languages
NLS_LOWER(str [,nls_
val]) -- same as lower for
different languages
REPLACE(str1, str2 [,str3]) -- r
eplaces str2 with str3 in str1
--
deletes str2 from str1 if str3 is omitted
RPAD(str1, num [,str
(default spaces)
2]) -- right pad str1 to
length num with str2
RTRIM(str [,set])
spaces)
-- remove set from
right side of str (default
SOUNDEX(str)
-- phonetic represen
tation of str
SUBSTR(str, num2 [,n
um1]) -- substring of str,
starting with num2,
--
omitted)
num1 characters (to end of str if num1 is
SUBSTRB(str, num2 [,
bytes
num1]) -- same as substr bu
t num1, num2 expressed in
TRANSLATE(str, set1,
set2) -- replaces set1 in
str with set2
--
truncated
if set2 is longer than set1, it will be
UPPER(str)
-- str with all lett
ers in uppercase
********************
***************
****************************
****************
* String Functions,
*
Numeric Result :
********************************
***********************
************************
ASCII(str)
-- ASCII value of str
INSTR(str1, str2 [,num1 [,num2]]
) -- position of num2th occurrence of
-- str2 in str1, starting at num1
-- (num1, num2 default to 1)
INSTRB(str1, str2 [,num1 [num2]]
) -- same as instr, byte values for num1, num2
LENGTH(str)
-- number of
characters in str
LENGTHB(str)
-- number of bytes in str
NLSSORT(str [,nls_val])
-- nls_val byte value of str
********************************
***********************
************************
* SQL Conversion Functions
*
********************************
***********************
************************
CHARTOROWID(str)
-- converts str to ROWID
CONVERT(str, chr_set2 [,chr_set1
]) -- converts str to chr_set2
character set
-- chr_set1
default is the datbase
HEXTORAW(str)
-- converts hex string va
lue to internal raw values
RAWTOHEX(raw_val) -- convert
s raw hex value to hex string value
ROWIDTOCHAR(rowid)
-- converts rowid to 18 ch
aracter string format
TO_CHAR(expr [,fmt])
fmt
-- converts expr(date or n
umber) to format specified by
TO_DATE(str [,fmt])
-- converts string to dat
e
TO_MULTI_BYTE(str) -- convert
s single byte string to multi byte string
TO_NUMBER(str [,fmt]) -- convert
s str to a number formatted by fmt
TO_SINGLE_BYTE(str)
-- converts multi byte st
ring to single byte string
********************************
***********************
************************
* SQL Date Formats
*
********************
***************
****************************
****************
BC, B.C. BC indicator AD, A.D. AD indicator CC, SCC Cent ury Code (SCC includes space or - sign) YYYY, SYYYY 4 digit year (SY YYY includes space or - sign) IYYY 4 digit ISO year Y,YYY 4 digit year with comma YYY, YY, or Y last 3, 2, or 1 digit of year YEAR, SYEAR year spelled out (SYEAR includes space or - sign) RR last 2 digits of year in prior or next century Q quarter or year, 1 to 4 MM month - from 01 to 12 MONTH month spelled out MON month 3 letter abbreviation RM roman numeral for month WW week of year, 1 to 53 IW ISO week of year , 1 to 52 or 1 to 53 W week of month, 1 to 5 (week 1 begins 1st day of the month) D day of week, 1 to 7 DD day of month, 1 to 31 DDD day of year, 1 to 366 DAY day of week spel led out, nine characters right padded DY day abbreviation J # of days since Jan 1, 4712 BC HH, HH12 hour of day, 1 to 12 HH24 hour of day, 0 to 23 MI minute of hour, 0 to 59 SS second of minute, 0 to 59 SSSSS seco nds past midnight, 0 to 8639 9 AM, A.M. am indicator PM, P.M. pm indicator any puctuation punc tuation between format items , as in 'DD/MM/YY' any text text between format items TH conv erts 1 to '1st', 2 to '2nd', and so on SP converts 1 to 'o ne', 2 to 'two', and so on SPTH converts 1 to 'F IRST', 2 to 'SECOND', and so on FX fill exact : uses exact pattern matching FM fill mode : tog gles suppression of blanks in output
简述oracle函数的功能,Oracle 最常用功能函数经典汇总 (zz)相关推荐
- 中常用的函数_ST语言编程中常用的函数/功能块
大部分PLC都会内置很多基本的函数和功能块供编程人员调用,而且很多具有通用性,也就是在不同品牌的PLC中,这些函数和功能块的名称.用法和功能相同,记住这些函数和功能块的名称和使用方法,能让我们编程时更 ...
- Oracle可以处理LOB字段的常用字符函数
以前处理LOB字段都是使用DBMS_LOB包,最近看了文档才发现,原来很多常用的字符函数都是支持LOB字段的. 建立一个测试表: SQL> CREATE TABLE T_LOB (ID NUMB ...
- oracle plsql 字符串长度,plsql中常用字符串函数
1.ASCII 返回与指定的字符对应的十进制数; SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space f ...
- python的功能名_python常用功能
1. 获取昨天日期 引入datetime模块 import datetime def getYesterday(): today = datetime.date.today() #返回当前本地日期 # ...
- python字符串的功能_Python字符串常用功能(一)
移除空白:rstrip去掉右边的空格以及tab制表符 def rstrip(self, *args, **kwargs): # real signature unknown ""& ...
- php有哪些_php工作原理是什么?php常用功能有哪些?
Php是超文本预处理器(Hypertext Preprocessor)英文全称首字母的缩写,php从1995年发展到现在现在已经成为流行开发动态网站的程序开源服务器端语言.它融合了c.java.per ...
- 3D游戏建模入门基础:3dmax常用功能详解
你收藏了那么多教程,却不知道3dmax怎么入门?掌握3dmax常用功能是3dmax入门的基础之一,所以呢小编今天就为您盘点了一些3dmax最常用到的功能和使用方法,快来和小编一起学习3dmax入门基础 ...
- 3dmax基础知识:3dmax常用功能详解,零基础小白的福音
你收藏了那么多教程,却不知道3dmax怎么入门?掌握3dmax常用功能是3dmax入门的基础之一,今天就为您盘点了一些3dmax最常用到的功能和使用方法,快来和小编一起学习3dmax入门基础知识吧! ...
- 计算机函数公式mod,excel函数公式大全,教您常用的Excel函数
其实我们对Excel函数公式上面的所知道的知识还是不够多的,所以我们还得要多加的学习这个方面的内容.今天小编来给大家介绍一下子我们平时使用的Excel的常用函数公式都有那些吧! 最近小编发现有小伙伴想 ...
最新文章
- P4588 [TJOI2018]数学计算(线段树维护区间乘和单点修改)
- setTimeOut()和setInterval()的用法
- 李彦宏的百度 AI 落地战略,由王海峰来实现
- 三星I9100[4.0 固件ROM] [2012.03.15]万众期待的欧版官方4.0.3完美汉化完美教程
- TypeScript入门-枚举
- HDF5数据库和mysql数据库_哪些数据库比较适合实现数据实时入库的需求?
- spring AOP 取得web的session
- Ubuntu/环境变量:修改/etc/environment 导致开机不能进入桌面
- linux下的汇编,linux下的汇编分析
- jpa mysql 配置文件_Spring+JPA+MySQL的配置文件
- oracle里面的锁,基于oracle中锁的深入理解
- 程序MD5校验的作用
- thinkphp5 一周学习总结 10月12日
- IPQ4019 QSDK 下添加RM500Q 5G 驱动 qmi拨号链接网络 配置 IPK包方法
- 在VMware虚拟机中安装RHEL7
- OSI七层协议的简介
- 如何0成本搭建外卖CPS返利小程序
- JavaSrcipt学习(学习打卡Day6)
- 什么是ADB,ADB有什么作用?
- C#使用System.Speech制作语音提示功能
热门文章
- Springboot启动完毕后提供了立刻执行自定义程序的两个接口类
- IDEA中提示JAVA字符串常量过长
- Java追加文本内容到txt文件
- php请求要通过什么协议,php – 发送多个应用程序协议请求(类似于mailto:)
- 随着电子计算机的应用 会计信息保存的形式,会计信息功系统简答题.doc
- python符号格式化设置区间_[Python3 填坑] 001 格式化符号 格式化操作符的辅助指令...
- 燃气灶电气线路图及原理_电气安装造价如何入门,核心知识已为你打包
- python查看微信撤回消息_python如何查看微信消息撤回
- python网页提交表单_使用Python中的POST请求通过网站表单上传基本文件
- 记录一次和朋友聊天遇到的面试题 ip地址字符串和long类型的相互转换 都是参考了别人的代码 加了一些个人理解的总结