
大家好,又见面了,我是你们的朋友全栈君。

一、拼接字符串1、使用“||”来拼接字符串:
select ‘拼接’||’字符串’ as Str from student;
2、使用concat(param1,param2)函数实现:
select concat(‘拼接’,’字符串’) as Str from student;
注:oracle的concat()方法只支持两个参数,如果拼接多个参数,可以嵌套concat():
select concat(concat(‘拼接’,’字符串’),’ab’) as Str from student;

select name as Str from account;
–使用双竖线来连接两个字符串
select ‘拼接’||’字符串’ as Str,name from account;
–和现有字段拼接
select ‘用户名:’||name as Str from account;
–拼接多个字符串
select ‘拼接’||’字符串’||’222字符串’ as Str,name from account;
–使用系统内置的函数来拼接 但是它只能拼接两个字符串
select concat(‘拼接’,’字符串’) as Str from account;
–如果要使用函数来拼接多个字符串 可以调用 多次concat
select concat(concat(‘拼接’,’字符串’),’ab’) as Str from account;
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/191296.html原文链接:https://javaforall.cn