Home > Database > Mysql Tutorial > body text

oracle ceil cos ascii chr函数

WBOY
Release: 2016-06-07 17:45:30
Original
1594 people have browsed it

1. ASCII

    返回与指定的字符对应的十进制数;

    SQL> select ascii(A) A,ascii(a) a,ascii(0) zero,ascii( ) space from dual;

    A A ZERO SPACE

  --------- --------- --------- ---------

    65 97 48 32

    2. CHR给出整数,返回对应的字符;

    SQL> select chr(54740) zhao,chr(65) chr65 from dual;

    ZH C

    -- -

    赵A

    3. CONCAT

    连接两个字符串;

    SQL> select concat(010-,88888888)||转23 高乾竞电话 from dual;

    高乾竞电话

  ----------------

    010-88888888转23

    4. INITCAP

    返回字符串并将字符串的第一个字母变为大写;

    SQL> select initcap(smith) upp from dual;

    UPP

  -----

    Smith

    5.INSTR(C1,C2,I,J)在一个字符串中搜索指定的字符,返回发现指定的字符的位置;

    C1被搜索的字符串

    C2希望搜索的字符串

    I 搜索的开始位置,默认为1 J 出现的位置,默认为1 SQL> select instr(oracle traning,ra,1,2) instring from dual;

    INSTRING

  ---------

    9

    6.LENGTH

    返回字符串的长度;

    SQL> select name,length(name),addr,length(addr),sal,length(to_char(sal)) from gao.nchar_tst;

    NAME LENGTH(NAME) ADDR LENGTH(ADDR) SAL LENGTH(TO_CHAR(SAL))

  ------ ------------ ---------------- ------------ --------- --------------------

    高乾竞 3 北京市海锭区 6 9999.99 7

    7.LOWER返回字符串,并将所有的字符小写

    SQL> select lower(AaBbCcDd)AaBbCcDd from dual;

    AABBCCDD

  --------

    aabbccdd

    8.UPPER返回字符串,并将所有的字符大写

    SQL> select upper(AaBbCcDd) upper from dual;

    UPPER

  --------

    AABBCCDD

    9.RPAD和LPAD(粘贴字符)

    RPAD在列的右边粘贴字符

    LPAD在列的左边粘贴字符

    SQL> select lpad(rpad(gao,10,*),17,*)from dual;

    LPAD(RPAD(GAO,1

  -----------------

    *******gao*******

    不够字符则用*来填满

    10.LTRIM和RTRIM

    LTRIM删除左边出现的字符串

    RTRIM删除右边出现的字符串

    SQL> select ltrim(rtrim( gao qian jing , ), ) from dual;

    LTRIM(RTRIM(

  -------------

    gao qian jing

     11.SUBSTR(string,start,count)取子字符串,从start开始,取count个SQL> select substr(13088888888,3,8) from dual;

    SUBSTR(

  --------

    08888888

    12.REPLACE(string,s1,s2)

    string希望被替换的字符或变量

    s1被替换的字符串

    s2要替换的字符串

    SQL> select replace(he love you,he,i) from dual;

    REPLACE(H

  ----------

    i love you

    13.SOUNDEX

    返回一个与给定的字符串读音相同的字符串

    SQL> create table table1(xm varchar(8));

    SQL> insert into table1 values(weather);

    SQL> insert into table1 values(wether);

    SQL> insert into table1 values(gao);

    SQL> select xm from table1 where soundex(xm)=soundex(weather);

    XM

  --------

    weather

    wether

    14.TRIM(s from string)

    LEADING剪掉前面的字符

    TRAILING剪掉后面的字符

    如果不指定,默认为空格符

    15.ABS

    返回指定值的绝对值

    SQL> select abs(100),abs(-100) from dual;

    ABS(100) ABS(-100)

  --------- ---------

    100 100

    16.ACOS

    给出反余弦的值

    SQL> select acos(-1) from dual;

    ACOS(-1)

  ---------

    3.1415927

    17.ASIN

    给出反正弦的值

    SQL> select asin(0.5) from dual;

    ASIN(0.5)

  ---------

    .52359878

    18.ATAN

    返回一个数字的反正切值

    SQL> select atan(1) from dual;

    ATAN(1)

  ---------

    .78539816

    19.CEIL

    返回大于或等于给出数字的最小整数

    SQL> select ceil(3.1415927) from dual;

    CEIL(3.1415927)

  ---------------

    4

    20.COS

    返回一个给定数字的余弦

    SQL> select cos(-3.1415927) from dual;

    COS(-3.1415927)

  ---------------

    -1

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template