Oracle 拼接字符串

语法

  1. 使用||拼接
  2. 如果内容中有单引号,则可在该单引号前面再加一个单引号进行转义

例子

比如有一个业务是根据需要生成多条插入语句

sql 复制代码
select 'insert into des_account_des_role(des_account_id, roles_id) values(''' || id || ''', ''' || (select id from des_role where workflowgroup = 'cor.client') || ''');' from des_account
where id in (
	select des_account_id from des_account_des_role 
	where roles_id in (select id from des_role where workflowgroup in ('chm.client', 'mch.client', 'phy.client'))
);
相关推荐
向風而行6 分钟前
MySQL详解
数据库·mysql
belldeep1 小时前
本草纲目:如何应用 PostgreSQL 实现【中医药】主题数据库 ?
数据库·postgresql·本草纲目
Bert.Cai1 小时前
MySQL CURTIME()函数详解
数据库·mysql
Bert.Cai1 小时前
MySQL CURDATE()函数详解
数据库·mysql
NGSI vimp1 小时前
MySQL|MySQL 中 `DATE_FORMAT()` 函数的使用
数据库·mysql
HAWK eoni1 小时前
Mysql 驱动程序
数据库·mysql
二哈赛车手2 小时前
新人笔记---实现简易版的rag的bm25检索(利用ES),以及RAG上传时的ES与向量数据库双写
java·数据库·笔记·spring·elasticsearch·ai
何中应2 小时前
CentOS 7安装、卸载MySQL数据库(二)
数据库·mysql·centos
KmSH8umpK2 小时前
Redis分布式锁从原生手写到Redisson高阶落地,附线上死锁复盘优化方案进阶第六篇
数据库·redis·分布式
梁萌2 小时前
mysql使用事件做日志表数据转移
数据库·mysql