oracle中单引号的处理

   当想让输出的结果中字段带有单引号',

场景一:连续三个单引号'''

 

 select '''helin''' from dual;
        ---'helin'

 

 

场景二:拼接字段的结果集--连续4个单引号

select 'update ct_cust_info set cust_name =',
       '''' || a.cust_name || '''',
       'cust_address = ',
       '''' || a.cust_address || '''',
       'where cust_id = ',
       '''' || a.cust_id || ''''
  from (select cust_id, cust_name, CUST_ADDRESS
          from ct_cust_info_crm
        minus
        select cust_id, cust_name, CUST_ADDRESS from ct_cust_info_billing1) a
--1    update ct_cust_info set cust_name =    '++SFVBIEJJTkc='    cust_address =     '++TEVWRUwgMzUsIDI1IENBTkFEQSBTUVVBUkUsIENBTkFSWSBXSEFSRiwgTE9ORE9OLCBFMTQgNUxR'    where cust_id =     '100321000000002243'
--2    update ct_cust_info set cust_name =    '++RE9ORyBIQU8='    cust_address =     '++TEVWRUwgMzUsIDI1IENBTkFEQSBTUVVBUkUsIENBTkFSWSBXSEFSRiwgTE9ORE9OLCBFMTQgNUxR'    where cust_id =     '100321000000002258'
 

 

场景三:和场景2一致,另一种写法:q'/string/'  中间的string表示任何字符

select 
'update ct_cust_info set cust_name =',
q'/'/'|| a.cust_name ||q'/',/',
'cust_address = ',
q'/'/'|| a.cust_address ||q'/'/',
'where cust_id = ',
q'/'/'|| a.cust_id ||q'/';/'
from 
(select cust_id,cust_name,CUST_ADDRESS  from ct_cust_info_crm
minus
select cust_id,cust_name,CUST_ADDRESS  from ct_cust_info_billing1) a

 

转载于:https://www.cnblogs.com/whut-helin/p/7928374.html

你可能感兴趣的:(oracle中单引号的处理)