基本函数:
SQL> select ascii(‘a’),ascii(‘Z’) from dual;

ASCII(‘A’) ASCII(‘Z’)
———- ———-
97 90

SQL>
SQL> select chr(65) from dual;

C

A

SQL> select chr(122) from dual;

C

z

SQL>
SQL> select chr(66) from dual;

C

B

SQL>
SQL> select concat(‘Hello ‘,’World’) from dual;

CONCAT(‘HEL
———–
Hello World

SQL>
SQL> select initcap(‘adamhuan’) from dual;

INITCAP(
——–
Adamhuan

SQL>

SQL> select instr(‘let is do it’,’i’,2,2) from dual;

INSTR(‘LETISDOIT’,’I’,2,2)
————————–
11

SQL>
说明:字符i在字符串中从第二个字符开始出现第二次的位置是第十一个字符。

SQL> select length(‘adamhuan’) from dual;

LENGTH(‘ADAMHUAN’)
——————
8

SQL>
SQL> select lower(‘ADAMHUAN’) from dual;

LOWER(‘A
——–
adamhuan

SQL>
SQL> select upper(‘adamhuan’) from dual;

UPPER(‘A
——–
ADAMHUAN

SQL>

SQL> select upper(‘adamhuan’) from dual;

UPPER(‘A
——–
ADAMHUAN

SQL> select lpad(‘dkseven’,9,’@’) from dual;

LPAD(‘DKS
———
@@dkseven

SQL> select lpad(‘dkseven’,2,’#’) from dual;

LP

dk

SQL> select rpad(‘dkseven’,9,’@’) from dual;

RPAD(‘DKS
———
dkseven@@

SQL> select rpad(‘dkseven’,2,’#’) from dual;

RP

dk

SQL>

SQL> select ltrim(‘adamhuan’,’a’) from dual;

LTRIM(‘
——-
damhuan

SQL>

SQL> select replace(‘adamhuan’,’a’,’e’) from dual;

REPLACE(
——–
edemhuen

SQL>

SQL> select rowid,deptno,dname,loc from dept;

ROWID DEPTNO DNAME LOC
—————— ———- ————– ————-
AAAVRCAAEAAAACHAAA 10 ACCOUNTING NEW YORK
AAAVRCAAEAAAACHAAB 20 RESEARCH DALLAS
AAAVRCAAEAAAACHAAC 30 SALES CHICAGO
AAAVRCAAEAAAACHAAD 40 OPERATIONS BOSTON

SQL> select * from dept where rowid=’AAAVRCAAEAAAACHAAB’;

DEPTNO DNAME LOC
———- ————– ————-
20 RESEARCH DALLAS

SQL> select * from dept where rowid=chartorowid(‘AAAVRCAAEAAAACHAAB’);

DEPTNO DNAME LOC
———- ————– ————-
20 RESEARCH DALLAS

SQL>
——————
Done。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

隐藏
变装