/*
CONCAT只能连接两个字符串
The syntax
for
the concat
function
is
:
concat( string1, string2 )
string1
is
the
first
string
to
concatenate.
string2
is
the
second
string
to
concatenate.
*/
--||可以连接多个字符串
SQL>
select
concat(
'CSDN'
,
'_yeeXun'
)
from
dual;
CONCAT(
'CSDN'
,
'_YEEXUN'
)
------------------------
CSDN_yeeXun
SQL>
select
'CSDN'
||
'_yeeXun'
from
dual;
'CSDN'
||
'_YEEXUN'
-----------------
CSDN_yeeXun
SQL>
select
concat(
'CSDN'
,
'_yeeXun'
,
'china'
)
from
dual;
select
concat(
'CSDN'
,
'_yeeXun'
,
'china'
)
from
dual
ORA-00909: invalid number
of
arguments
SQL>
select
'CSDN'
||
'_yeeXun'
||
'china'
from
dual;
'CSDN'
||
'_YEEXUN'
||
'CHINA'
--------------------------
CSDN_yeeXunchina
--concat只能连接两个字符串,连接多个需要嵌套调用不方便
SQL>
select
concat(
'aa'
,
'bb'
)
from
dual;
CONCAT(
'AA'
,
'BB'
)
-----------------
aabb
--||直接连接多个字符串
SQL>
select
'aa'
||
'bb'
||
'cc'
from
dual;
'AA'
||
'BB'
||
'CC'
----------------
aabbcc
SQL>
select concat(concat('aa',','),'bb') from dual
这样得到的结果就是:
CONCAT(CONCAT('AA',','),'BB')
-----------------------------
aa,bb