|
课程第9次2016-09-19星期一:
单行函数和转换函数介绍完了。
【1Z0-051】:共12章(0 1 2 3 4 5 6 7 8 9 10 11)
【1Z0-052】:共19章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
【1Z0-053】:共21章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
2016-09-19a.sql:
- [root@station90 ~]# su - oracle
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 19 19:34:46 2016
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn hr/oracle_4U
- Connected.
- SQL> select 'a' from dual;
- '
- -
- a
- SQL> select * from dual;
- D
- -
- X
- SQL> conn / as sysdba
- Connected.
- SQL> select open_mode from v$database;
- OPEN_MODE
- --------------------
- READ WRITE
- SQL> conn hr/oracle_4U
- Connected.
- SQL> select open_mode from v$database;
- select open_mode from v$database
- *
- ERROR at line 1:
- ORA-00942: table or view does not exist
- SQL> select * from dual;
- D
- -
- X
- SQL> select substr('HelloWorld',1,5 ) from dual;
- SUBST
- -----
- Hello
- SQL> select substr('HelloWorld',-1,1 ) from dual;
- S
- -
- d
- SQL> select substr('HelloWorld',-1,5 ) from dual;
- S
- -
- d
- SQL> select substr('HelloWorld',-1,0 ) from dual;
- S
- -
- SQL> select substr('HelloWorld',1,0 ) from dual;
- S
- -
- SQL> select substr('HelloWorld',2,1 ) from dual;
- S
- -
- e
- SQL> select substr('HelloWorld',2 ) from dual;
- SUBSTR('H
- ---------
- elloWorld
- SQL> select substr('HelloWorld',2 ) from dual;
- SUBSTR('H
- ---------
- elloWorld
- SQL> select substr('HelloWorld',-4 ) from dual;
- SUBS
- ----
- orld
- SQL> create table t05103_zh( a varchar2(4));
- Table created.
- SQL> insert into t05103_zh values ('中国') ;
- insert into t05103_zh values ('中国')
- *
- ERROR at line 1:
- ORA-12899: value too large for column "HR"."T05103_ZH"."A" (actual: 6, maximum:
- 4)
- SQL> alter table t05103_zh modify ( a varchar2(6)) ;
- Table altered.
- SQL> insert into t05103_zh values ('中国') ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> select length(a) from t05103_zh ;
- LENGTH(A)
- ----------
- 2
- SQL> select length2(a) from t05103_zh ;
- LENGTH2(A)
- ----------
- 2
- SQL> select lengthb(a) from t05103_zh ;
- LENGTHB(A)
- ----------
- 6
- SQL> select instr('HelloWorld','W' ) from dual;
- INSTR('HELLOWORLD','W')
- -----------------------
- 6
- SQL> select instr('HelloWorld','w' ) from dual;
- INSTR('HELLOWORLD','W')
- -----------------------
- 0
- SQL> select instr('HelloWorld','Wor' ) from dual;
- INSTR('HELLOWORLD','WOR')
- -------------------------
- 6
- SQL> select instr('HelloWorld','or' ) from dual;
- INSTR('HELLOWORLD','OR')
- ------------------------
- 7
- SQL> select trim ('H' from 'HelloWorld' ) from dual;
- TRIM('H'F
- ---------
- elloWorld
- SQL> select trim ('d' from 'HelloWorld' ) from dual;
- TRIM('D'F
- ---------
- HelloWorl
- SQL> select trim ('e' from 'HelloWorld' ) from dual;
- TRIM('E'FR
- ----------
- HelloWorld
- SQL> select trim ('W' from 'Hello World' ) from dual;
- TRIM('W'FRO
- -----------
- Hello World
- SQL> select trim ('H' from 'Hello World' ) from dual;
- TRIM('H'FR
- ----------
- ello World
- SQL> select replace ('Hello World','e','' ) from dual;
- REPLACE('H
- ----------
- Hllo World
- SQL> select replace ('Hello World','o','' ) from dual;
- REPLACE('
- ---------
- Hell Wrld
- SQL> select ROUND(45.926, 2) from dual;
- ROUND(45.926,2)
- ---------------
- 45.93
- SQL> select ROUND(45.926) from dual;
- ROUND(45.926)
- -------------
- 46
- SQL> select ROUND(45.926,0) from dual;
- ROUND(45.926,0)
- ---------------
- 46
- SQL> select ROUND(45.926,-1) from dual;
- ROUND(45.926,-1)
- ----------------
- 50
- SQL> select ROUND(45.926,-2) from dual;
- ROUND(45.926,-2)
- ----------------
- 0
- SQL> select ROUND(45.926,-1) from dual;
- ROUND(45.926,-1)
- ----------------
- 50
- SQL> select trunc(45.926,-1) from dual;
- TRUNC(45.926,-1)
- ----------------
- 40
- SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR',to_date('11-JAN-94','DD-MON-RR') ) from dual;
- select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR',to_date('11-JAN-94','DD-MON-RR') ) from dual
- *
- ERROR at line 1:
- ORA-00909: invalid number of arguments
- SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR'),to_date('11-JAN-94','DD-MON-RR') ) from dual;
- MONTHS_BETWEEN(TO_DATE('01-SEP-95','DD-MON-RR'),TO_DATE('11-JAN-94','DD-MON-RR')
- --------------------------------------------------------------------------------
- 19.6774194
- SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-YY'),to_date('11-JAN-94','DD-MON-RR') ) from dual;
- MONTHS_BETWEEN(TO_DATE('01-SEP-95','DD-MON-YY'),TO_DATE('11-JAN-94','DD-MON-RR')
- --------------------------------------------------------------------------------
- 1219.67742
- SQL> select MONTHS_BETWEEN( to_date('11-JAN-94','DD-MON-RR'), to_date('01-SEP-95','DD-MON-RR') ) from dual;
- MONTHS_BETWEEN(TO_DATE('11-JAN-94','DD-MON-RR'),TO_DATE('01-SEP-95','DD-MON-RR')
- --------------------------------------------------------------------------------
- -19.677419
- SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR'),to_date('11-JAN-94','DD-MON-RR') ) from dual;
- MONTHS_BETWEEN(TO_DATE('01-SEP-95','DD-MON-RR'),TO_DATE('11-JAN-94','DD-MON-RR')
- --------------------------------------------------------------------------------
- 19.6774194
- SQL> select (to_date('01-SEP-95','DD-MON-RR')-to_date('11-JAN-94','DD-MON-RR') )/30 from dual;
- (TO_DATE('01-SEP-95','DD-MON-RR')-TO_DATE('11-JAN-94','DD-MON-RR'))/30
- ----------------------------------------------------------------------
- 19.9333333
- SQL> select (to_date('01-SEP-95','DD-MON-RR')-to_date('11-JAN-94','DD-MON-RR') )/31 from dual;
- (TO_DATE('01-SEP-95','DD-MON-RR')-TO_DATE('11-JAN-94','DD-MON-RR'))/31
- ----------------------------------------------------------------------
- 19.2903226
- SQL> select (to_date('01-SEP-95','DD-MON-RR')-to_date('11-JAN-94','DD-MON-RR') )/29 from dual;
- (TO_DATE('01-SEP-95','DD-MON-RR')-TO_DATE('11-JAN-94','DD-MON-RR'))/29
- ----------------------------------------------------------------------
- 20.6206897
- SQL> select add_months(sysdate , 1 ) from dual;
- ADD_MONTHS(SYSDATE
- ------------------
- 19-OCT-16
- SQL> select add_months(sysdate , 3 ) from dual;
- ADD_MONTHS(SYSDATE
- ------------------
- 19-DEC-16
- SQL> select next_day( sysdate,'Tuesday') from dual;
- NEXT_DAY(SYSDATE,'
- ------------------
- 20-SEP-16
- SQL> select next_day( sysdate,'Sunday') from dual;
- NEXT_DAY(SYSDATE,'
- ------------------
- 25-SEP-16
- SQL> select next_day( sysdate,0) from dual;
- select next_day( sysdate,0) from dual
- *
- ERROR at line 1:
- ORA-01846: not a valid day of the week
- SQL> select next_day( sysdate,'0') from dual;
- select next_day( sysdate,'0') from dual
- *
- ERROR at line 1:
- ORA-01846: not a valid day of the week
- SQL> select next_day( sysdate,'Sunday') from dual;
- NEXT_DAY(SYSDATE,'
- ------------------
- 25-SEP-16
- SQL> select next_day( sysdate,'Sunday') from dual;
- NEXT_DAY(SYSDATE,'
- ------------------
- 25-SEP-16
- SQL>
- SQL> select next_day( sysdate,7) from dual;
- NEXT_DAY(SYSDATE,7
- ------------------
- 24-SEP-16
- SQL> select next_day( sysdate,0) from dual;
- select next_day( sysdate,0) from dual
- *
- ERROR at line 1:
- ORA-01846: not a valid day of the week
- SQL> select next_day( sysdate,1) from dual;
- NEXT_DAY(SYSDATE,1
- ------------------
- 25-SEP-16
- SQL> conn / as sysdba
- Connected.
- SQL> show parameter nls_terri
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- nls_territory string AMERICA
- SQL> select next_day( sysdate,1) from dual;
- NEXT_DAY(SYSDATE,1
- ------------------
- 25-SEP-16
- SQL> alter system set nls_territory=china;
- alter system set nls_territory=china
- *
- ERROR at line 1:
- ORA-02096: specified initialization parameter is not modifiable with this
- option
- SQL> conn hr/oracle_4U
- Connected.
- SQL> alter session set nls_territory=china;
- Session altered.
- SQL> select next_day(sysdate,1) from dual;
- NEXT_DAY(SYSDATE,1
- ------------------
- 25-SEP-16
- SQL> alter session set nls_territory=australia;
- Session altered.
- SQL> select next_day(sysdate,1) from dual;
- NEXT_DAY(SYSDATE,1
- ------------------
- 26/SEP/16
- SQL> select next_day(sysdate,'Sunday') from dual;
- NEXT_DAY(SYSDATE,'
- ------------------
- 25/SEP/16
- SQL> select round(sysdate,'month') from dual;
- ROUND(SYSDATE,'MON
- ------------------
- 01/OCT/16
- SQL> select round(to_Date('2016-02-15','YYYY-MM-DD') ,'month') from dual;
- ROUND(TO_DATE('201
- ------------------
- 01/FEB/16
- SQL> select round(to_Date('2016-02-16','YYYY-MM-DD') ,'month') from dual;
- ROUND(TO_DATE('201
- ------------------
- 01/MAR/16
- SQL> select round(to_Date('2016-07-16','YYYY-MM-DD') ,'month') from dual;
- ROUND(TO_DATE('201
- ------------------
- 01/AUG/16
- SQL> select round(to_Date('2016-07-15','YYYY-MM-DD') ,'month') from dual;
- ROUND(TO_DATE('201
- ------------------
- 01/JUL/16
- SQL> select round(to_Date('2016-07-01','YYYY-MM-DD') ,'year') from dual;
- ROUND(TO_DATE('201
- ------------------
- 01/JAN/17
- SQL> select round(to_Date('2016-06-30','YYYY-MM-DD') ,'year') from dual;
- ROUND(TO_DATE('201
- ------------------
- 01/JAN/16
- SQL> select last_day(to_Date('2016-02-13','YYYY-MM-DD')) from dual;
- LAST_DAY(TO_DATE('
- ------------------
- 29/FEB/16
- SQL> select last_day(to_Date('2015-02-13','YYYY-MM-DD')) from dual;
- LAST_DAY(TO_DATE('
- ------------------
- 28/FEB/15
- SQL>
复制代码
2016-09-19b.sql:
[code][root@station90 ~]# su - oracle
[oracle@station90 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 19 19:34:46 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn hr/oracle_4U
Connected.
SQL> select 'a' from dual;
'
-
a
SQL> select * from dual;
D
-
X
SQL> conn / as sysdba
Connected.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> conn hr/oracle_4U
Connected.
SQL> select open_mode from v$database;
select open_mode from v$database
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select * from dual;
D
-
X
SQL> select substr('HelloWorld',1,5 ) from dual;
SUBST
-----
Hello
SQL> select substr('HelloWorld',-1,1 ) from dual;
S
-
d
SQL> select substr('HelloWorld',-1,5 ) from dual;
S
-
d
SQL> select substr('HelloWorld',-1,0 ) from dual;
S
-
SQL> select substr('HelloWorld',1,0 ) from dual;
S
-
SQL> select substr('HelloWorld',2,1 ) from dual;
S
-
e
SQL> select substr('HelloWorld',2 ) from dual;
SUBSTR('H
---------
elloWorld
SQL> select substr('HelloWorld',2 ) from dual;
SUBSTR('H
---------
elloWorld
SQL> select substr('HelloWorld',-4 ) from dual;
SUBS
----
orld
SQL> create table t05103_zh( a varchar2(4));
Table created.
SQL> insert into t05103_zh values ('中国') ;
insert into t05103_zh values ('中国')
*
ERROR at line 1:
ORA-12899: value too large for column "HR"."T05103_ZH"."A" (actual: 6, maximum:
4)
SQL> alter table t05103_zh modify ( a varchar2(6)) ;
Table altered.
SQL> insert into t05103_zh values ('中国') ;
1 row created.
SQL> commit;
Commit complete.
SQL> select length(a) from t05103_zh ;
LENGTH(A)
----------
2
SQL> select length2(a) from t05103_zh ;
LENGTH2(A)
----------
2
SQL> select lengthb(a) from t05103_zh ;
LENGTHB(A)
----------
6
SQL> select instr('HelloWorld','W' ) from dual;
INSTR('HELLOWORLD','W')
-----------------------
6
SQL> select instr('HelloWorld','w' ) from dual;
INSTR('HELLOWORLD','W')
-----------------------
0
SQL> select instr('HelloWorld','Wor' ) from dual;
INSTR('HELLOWORLD','WOR')
-------------------------
6
SQL> select instr('HelloWorld','or' ) from dual;
INSTR('HELLOWORLD','OR')
------------------------
7
SQL> select trim ('H' from 'HelloWorld' ) from dual;
TRIM('H'F
---------
elloWorld
SQL> select trim ('d' from 'HelloWorld' ) from dual;
TRIM('D'F
---------
HelloWorl
SQL> select trim ('e' from 'HelloWorld' ) from dual;
TRIM('E'FR
----------
HelloWorld
SQL> select trim ('W' from 'Hello World' ) from dual;
TRIM('W'FRO
-----------
Hello World
SQL> select trim ('H' from 'Hello World' ) from dual;
TRIM('H'FR
----------
ello World
SQL> select replace ('Hello World','e','' ) from dual;
REPLACE('H
----------
Hllo World
SQL> select replace ('Hello World','o','' ) from dual;
REPLACE('
---------
Hell Wrld
SQL> select ROUND(45.926, 2) from dual;
ROUND(45.926,2)
---------------
45.93
SQL> select ROUND(45.926) from dual;
ROUND(45.926)
-------------
46
SQL> select ROUND(45.926,0) from dual;
ROUND(45.926,0)
---------------
46
SQL> select ROUND(45.926,-1) from dual;
ROUND(45.926,-1)
----------------
50
SQL> select ROUND(45.926,-2) from dual;
ROUND(45.926,-2)
----------------
0
SQL> select ROUND(45.926,-1) from dual;
ROUND(45.926,-1)
----------------
50
SQL> select trunc(45.926,-1) from dual;
TRUNC(45.926,-1)
----------------
40
SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR',to_date('11-JAN-94','DD-MON-RR') ) from dual;
select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR',to_date('11-JAN-94','DD-MON-RR') ) from dual
*
ERROR at line 1:
ORA-00909: invalid number of arguments
SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR'),to_date('11-JAN-94','DD-MON-RR') ) from dual;
MONTHS_BETWEEN(TO_DATE('01-SEP-95','DD-MON-RR'),TO_DATE('11-JAN-94','DD-MON-RR')
--------------------------------------------------------------------------------
19.6774194
SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-YY'),to_date('11-JAN-94','DD-MON-RR') ) from dual;
MONTHS_BETWEEN(TO_DATE('01-SEP-95','DD-MON-YY'),TO_DATE('11-JAN-94','DD-MON-RR')
--------------------------------------------------------------------------------
1219.67742
SQL> select MONTHS_BETWEEN( to_date('11-JAN-94','DD-MON-RR'), to_date('01-SEP-95','DD-MON-RR') ) from dual;
MONTHS_BETWEEN(TO_DATE('11-JAN-94','DD-MON-RR'),TO_DATE('01-SEP-95','DD-MON-RR')
--------------------------------------------------------------------------------
-19.677419
SQL> select MONTHS_BETWEEN(to_date('01-SEP-95','DD-MON-RR'),to_date('11-JAN-94','DD-MON-RR') ) from dual;
MONTHS_BETWEEN(TO_DATE('01-SEP-95','DD-MON-RR'),TO_DATE('11-JAN-94','DD-MON-RR')
--------------------------------------------------------------------------------
19.6774194
SQL> select (to_date('01-SEP-95','DD-MON-RR')-to_date('11-JAN-94','DD-MON-RR') )/30 from dual;
(TO_DATE('01-SEP-95','DD-MON-RR')-TO_DATE('11-JAN-94','DD-MON-RR'))/30
----------------------------------------------------------------------
19.9333333
SQL> select (to_date('01-SEP-95','DD-MON-RR')-to_date('11-JAN-94','DD-MON-RR') )/31 from dual;
(TO_DATE('01-SEP-95','DD-MON-RR')-TO_DATE('11-JAN-94','DD-MON-RR'))/31
----------------------------------------------------------------------
19.2903226
SQL> select (to_date('01-SEP-95','DD-MON-RR')-to_date('11-JAN-94','DD-MON-RR') )/29 from dual;
(TO_DATE('01-SEP-95','DD-MON-RR')-TO_DATE('11-JAN-94','DD-MON-RR'))/29
----------------------------------------------------------------------
20.6206897
SQL> select add_months(sysdate , 1 ) from dual;
ADD_MONTHS(SYSDATE
------------------
19-OCT-16
SQL> select add_months(sysdate , 3 ) from dual;
ADD_MONTHS(SYSDATE
------------------
19-DEC-16
SQL> select next_day( sysdate,'Tuesday') from dual;
NEXT_DAY(SYSDATE,'
------------------
20-SEP-16
SQL> select next_day( sysdate,'Sunday') from dual;
NEXT_DAY(SYSDATE,'
------------------
25-SEP-16
SQL> select next_day( sysdate,0) from dual;
select next_day( sysdate,0) from dual
*
ERROR at line 1:
ORA-01846: not a valid day of the week
SQL> select next_day( sysdate,'0') from dual;
select next_day( sysdate,'0') from dual
*
ERROR at line 1:
ORA-01846: not a valid day of the week
SQL> select next_day( sysdate,'Sunday') from dual;
NEXT_DAY(SYSDATE,'
------------------
25-SEP-16
SQL> select next_day( sysdate,'Sunday') from dual;
NEXT_DAY(SYSDATE,'
------------------
25-SEP-16
SQL>
SQL> select next_day( sysdate,7) from dual;
NEXT_DAY(SYSDATE,7
------------------
24-SEP-16
SQL> select next_day( sysdate,0) from dual;
select next_day( sysdate,0) from dual
*
ERROR at line 1:
ORA-01846: not a valid day of the week
SQL> select next_day( sysdate,1) from dual;
NEXT_DAY(SYSDATE,1
------------------
25-SEP-16
SQL> conn / as sysdba
Connected.
SQL> show parameter nls_terri
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_territory string AMERICA
SQL> select next_day( sysdate,1) from dual;
NEXT_DAY(SYSDATE,1
------------------
25-SEP-16
SQL> alter system set nls_territory=china;
alter system set nls_territory=china
*
ERROR at line 1:
ORA-02096: specified initialization parameter is not modifiable with this
option
SQL> conn hr/oracle_4U
Connected.
SQL> alter session set nls_territory=china;
Session altered.
SQL> select next_day(sysdate,1) from dual;
NEXT_DAY(SYSDATE,1
------------------
25-SEP-16
SQL> alter session set nls_territory=australia;
Session altered.
SQL> select next_day(sysdate,1) from dual;
NEXT_DAY(SYSDATE,1
------------------
26/SEP/16
SQL> select next_day(sysdate,'Sunday') from dual;
NEXT_DAY(SYSDATE,'
------------------
25/SEP/16
SQL> select round(sysdate,'month') from dual;
ROUND(SYSDATE,'MON
------------------
01/OCT/16
SQL> select round(to_Date('2016-02-15','YYYY-MM-DD') ,'month') from dual;
ROUND(TO_DATE('201
------------------
01/FEB/16
SQL> select round(to_Date('2016-02-16','YYYY-MM-DD') ,'month') from dual;
ROUND(TO_DATE('201
------------------
01/MAR/16
SQL> select round(to_Date('2016-07-16','YYYY-MM-DD') ,'month') from dual;
ROUND(TO_DATE('201
------------------
01/AUG/16
SQL> select round(to_Date('2016-07-15','YYYY-MM-DD') ,'month') from dual;
ROUND(TO_DATE('201
------------------
01/JUL/16
SQL> select round(to_Date('2016-07-01','YYYY-MM-DD') ,'year') from dual;
ROUND(TO_DATE('201
------------------
01/JAN/17
SQL> select round(to_Date('2016-06-30','YYYY-MM-DD') ,'year') from dual;
ROUND(TO_DATE('201
------------------
01/JAN/16
SQL> select last_day(to_Date('2016-02-13','YYYY-MM-DD')) from dual;
LAST_DAY(TO_DATE('
------------------
29/FEB/16
SQL> select last_day(to_Date('2015-02-13','YYYY-MM-DD')) from dual;
LAST_DAY(TO_DATE('
------------------
28/FEB/15
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@station90 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 19 20:59:26 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> show parameter nls_ter
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_territory string AMERICA
SQL> show parameter nls_langu
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_language string AMERICAN
SQL> select to_char(sysdate , 'MONTH' ) from dual;
TO_CHAR(SYSDATE,'MONTH')
------------------------------------
SEPTEMBER
SQL> select to_char(sysdate , 'Month' ) from dual;
TO_CHAR(SYSDATE,'MONTH')
------------------------------------
September
SQL> conn hr/oracle_4U
Connected.
SQL> alter session set nls_language=korean;
Session altered.
SQL> select to_char(sysdate , 'MONTH' ) from dual;
TO_CHAR(
--------
9월
SQL> alter session set nls_language=italian;
Session altered.
SQL> select to_char(sysdate , 'MONTH' ) from dual;
TO_CHAR(SYSDATE,'MONTH')
------------------------------------
SETTEMBRE
SQL> alter session set nls_language=fench;
ERROR:
ORA-12705: Impossibile accedere ai file di dati NLS oppure l'ambiente
specificato non è valido
SQL> alter session set nls_language=french;
Session altered.
SQL> select to_char(sysdate , 'MONTH' ) from dual;
TO_CHAR(SYSDATE,'MONTH')
------------------------------------
SEPTEMBRE
SQL> alter session set nls_language=tailanian;
ERROR:
ORA-12705: Impossible d'accéder aux fichiers de données NLS ou l'environnement
indiqué n'est pas valide
SQL> select to_char(sysdate , 'DY' ) from dual;
TO_CHAR(SYSDATE,
----------------
LUN.
SQL> alter session set nls_language=american;
Session altered.
SQL> select to_char(sysdate , 'DY' ) from dual;
TO_CHAR(SYSD
------------
MON
SQL> alter session set nls_language='simplified chinese';
Session altered.
SQL> select to_char(sysdate , 'DY' ) from dual;
TO_CHAR(SYSD
------------
星期一
SQL> alter session set nls_language='traditional chinese';
Session altered.
SQL> select to_char(sysdate , 'DY' ) from dual;
TO_CHAR(SYSD
------------
星期一
SQL> select to_char(sysdate , 'YEAR' ) from dual;
TO_CHAR(SYSDATE,'YEAR')
------------------------------------------
TWENTY SIXTEEN
SQL> select to_char(sysdate , 'year' ) from dual;
TO_CHAR(SYSDATE,'YEAR')
------------------------------------------
twenty sixteen
SQL> select to_char(sysdate , 'dd' ) from dual;
TO
--
19
SQL> select to_char(sysdate , 'd' ) from dual;
T
-
2
SQL> alter session set nls_territary=australia;
alter session set nls_territary=australia
*
ERROR at line 1:
ORA-00922: 遺漏選項, 或此選項無效
SQL> alter session set nls_territey=australia;
alter session set nls_territey=australia
*
ERROR at line 1:
ORA-00922: 遺漏選項, 或此選項無效
SQL> alter session set nls_teritey=australia;
alter session set nls_teritey=australia
*
ERROR at line 1:
ORA-00922: 遺漏選項, 或此選項無效
SQL> alter session set nls_territory=australia;
Session altered.
SQL> select to_char(sysdate , 'd' ) from dual;
T
-
1
SQL> select to_char(sysdate , 'ddd' ) from dual;
TO_
---
263
SQL> alter session set nls_territory=china;
Session altered.
SQL> select to_char(sysdate , 'ddd' ) from dual;
TO_
---
263
SQL> select to_char( sysdate , 'YYYY-MM-DD' ) from dual;
TO_CHAR(SY
----------
2016-09-19
SQL> select to_char( sysdate , 'fmYYYY-MM-DD' ) from dual;
TO_CHAR(SY
----------
2016-9-19
SQL> select to_char( sysdate , 'fmYYYY-MM-DD "is my birthday" ' ) from dual;
TO_CHAR(SYSDATE,'FMYYYY-MM-DD
-----------------------------
2016-9-19 is my birthday
SQL> select to_char( sysdate , 'fmYYYY-MM-DDspth "is my birthday" ' ) from dual;
TO_CHAR(SYSDATE,'FMYYYY-MM-DDSPTH"ISMYBIR
-----------------------------------------
2016-9-NINETEENTH is my birthday
SQL> select to_char( sysdate , 'fmYYYY-MM-ddspth "is my birthday" ' ) from dual;
TO_CHAR(SYSDATE,'FMYYYY-MM-DDSPTH"ISMYBIR
-----------------------------------------
2016-9-nineteenth is my birthday
SQL> select salary from employees where employee_id=100;
SALARY
----------
24000
SQL> select to_char(salary,'L999,999,999.99' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L999,999,
-------------------------
¥24,000.00
SQL> select to_char(salary,'L999.99' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L
-----------------
#################
SQL> select to_char(salary,'L999,999,999.99' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L999,999,
-------------------------
¥24,000.00
SQL> select to_char(salary,'L000,000,000,000,000.99' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L000,000,000,000,
---------------------------------
¥000,000,000,024,000.00
SQL> select to_char(salary,'L000,000,000,000,000.00' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L000,000,000,000,
---------------------------------
¥000,000,000,024,000.00
SQL> select to_char(salary,'L000,000,000,000,000.009' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L000,000,000,000,0
----------------------------------
¥000,000,000,024,000.000
SQL> select to_char(salary,'L000,000,000,000,000.00' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L000,000,000,000,
---------------------------------
¥000,000,000,024,000.00
SQL> alter session set nls_territory=france;
Session altered.
SQL> select to_char(salary,'L000,000,000,000,000.00' ) from employees where employee_id=100;
TO_CHAR(SALARY,'L000,000,000,000,
---------------------------------
|
|