oracle中的简单语法 在oracle中的sql语句select to_char(name)||'-'||to_char(no) from student其中语法to_char(name)||'-'||to_char(no)表示的什么呀? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 to_char是转换为字符|| 是连接符'-' 是一个字符. 就是将 name 和 no 这两个字段中间用 - 给连接起来 举一个例子,如下:SQL> select * from trigger_test 2 /COL1 COL2 COL3-------------------- -------------------- --------------------AS02 901 OOAS09 402 X1AS05 303 X2AS03 20 O1AS10 904 09SQL> select col1||'-'||col2||':'||col3 from trigger_test;COL1||'-'||COL2||':'||COL3--------------------------------------------------------------AS02-901:OOAS09-402:X1AS05-303:X2AS03-20:O1AS10-904:09希望你能理解 || 相当于 java 中的 + 就是将两部分连接起来。 1、||是字符串连接符,还可以使用concat()函数来进行连接:select concat('hellow','world') from dual; 类似concat的字符函数还有许多,比如:select substr('hello',1,3), --截取字符串length('hello'), --字符串长度 replace('hello','l','x')--字符串替换 from dual;2、toChar()是转换函数:转换成字符串,类似还有:to_number(): 转换成数字 ;to_date(): 转换成日期select to_number('123'),to_date('2004-05-07 13:23:44','yyyy-mm-dd hh24:mi:ss'),to_char(to_date('2010-3-21','yyyy-mm-dd'),'day')from dual; ||是字符串连接符to_char是转换函数:转成为字符串,如:select to_number('123'),to_date('2004-05-07 13:23:44','yyyy-mm-dd hh24:mi:ss'),to_char(to_date('2010-3-21','yyyy-mm-dd'),'day')from dual; oracle 中extent的设置 求助一个SQL语句 通过更新数据时,出现“ORA-01403: 未找到数据”错误 跪求一条sql统计语句 学习oracle管理该学哪方面的东西,能推荐基本好书吗 错误(ERROR - ORA-12154: TNS:could not resolve the connect identifier specified) 连接ORACLE出现的问题 存储过程中的游标问题!急! 欢迎讨论,oracle 8i or oracle 9i 关于ORACL之DDL触发器的1个问题 问一个“一对多数据合并”的问题 测试存储过程语句报参数类型或数量错误
|| 是连接符
'-' 是一个字符.
2 /COL1 COL2 COL3
-------------------- -------------------- --------------------
AS02 901 OO
AS09 402 X1
AS05 303 X2
AS03 20 O1
AS10 904 09SQL> select col1||'-'||col2||':'||col3 from trigger_test;COL1||'-'||COL2||':'||COL3
--------------------------------------------------------------
AS02-901:OO
AS09-402:X1
AS05-303:X2
AS03-20:O1
AS10-904:09希望你能理解
select concat('hellow','world') from dual;
类似concat的字符函数还有许多,比如:select substr('hello',1,3), --截取字符串length('hello'), --字符串长度 replace('hello','l','x')--字符串替换 from dual;
2、toChar()是转换函数:转换成字符串,类似还有:
to_number(): 转换成数字 ;to_date(): 转换成日期select to_number('123'),to_date('2004-05-07 13:23:44','yyyy-mm-dd hh24:mi:ss'),to_char(to_date('2010-3-21','yyyy-mm-dd'),'day')from dual;