语法
- 使用
||
拼接 - 如果内容中有单引号,则可在该单引号前面再加一个单引号进行转义
例子
比如有一个业务是根据需要生成多条插入语句
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'))
);