oracle数据库连接串,oracle数据库三种连接方式

首页 > 大全 > 作者:YD1662022-12-22 11:09:15

日常工作中,时常需要将两个或多个字符串拼接在一起,组合成一个新的字符串。而字符串拼接地实现在各个关系型数据库中略有差异。

1.Oracle中,使用 “||”拼接符或concat函数实现字符串拼接:

select concat('hello','oracle') from dual;

输出结果为:hellooracle

在Oracle中concat函数只能拼接两个字符串,如果想拼接两个以上的字符串可以使用 “||”拼接符:

select 'hello'||'sql'||'oracle' from dual;

输出结果为:hellosqloracle

2. SQL Server中,使用“ ”或concat 函数(SQLSERVER 2012 新增) 实现字符串拼接:

select concat('hello','sql','SQLSERVER');

select 'hello' 'sql' 'SQLSERVER';

输出结果均为:hellosqlSQLSERVER

3.MySQL中,使用concat函数拼接字符串:

select concat('hello','sql','Mysql');

输出结果为:hellosqlMysql

4.PostGreSQL中,使用 “||” 或concat函数实现字符串拼接:

select concat('hello','sql','PostgreSQL');

select 'hello'||'sql'||'PostgreSQL';

输出结果为: hellosqlPostgreSQL。

oracle数据库连接串,oracle数据库三种连接方式(1)

查询输出结果

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.