sql如下:
select (case when '{10}' = 'no' then '' else ' and (CASE WHEN T2.C700020017<>0 AND T2.C700020017>T2.C710020022 THEN "已结单" WHEN T2.C700020017=0 AND T2.C710020022<(sysdate-TO_DATE("19700101","yyyymmdd"))*86400-28800 THEN "已接单" ELSE "未结单" END)= '||'''{10}''' end) c from dual
得到的结果是:
and (CASE WHEN T2.C700020017<>0 AND T2.C700020017>T2.C710020022 THEN "已结单" WHEN T2.C700020017=0 AND T2.C710020022<(sysdate-TO_DATE("19700101","yyyymmdd"))*86400-28800 THEN "已结单" ELSE "未结单" END)= '{10}'
我想要的结果是:
and (CASE WHEN T2.C700020017<>0 AND T2.C700020017>T2.C710020022 THEN '已结单' WHEN T2.C700020017=0 AND T2.C710020022<(sysdate-TO_DATE('19700101','yyyymmdd'))*86400-28800 THEN "已结单" ELSE '未结单' END)= '{10}'
------解决方案--------------------
'''and (CASE WHEN T2.C700020017<>0 AND T2.C700020017>T2.C710020022 THEN '''
------解决方案--------------------
'It''s Yours'
开头的和结尾的表示字符的起始和结尾,不会显示。
如果想在字符中插入单引号,用''表示,不存在三个,三个是开头之后紧接着一个单引号/单引号之后直接结尾。
------解决方案--------------------
select CASE WHEN '{10}'='no' THEN 'a' ELSE '''and?(
CASE?WHEN?T2.C700020017<>0?AND?T2.C700020017>T2.C710020022?THEN?''已结单''?WHEN?T2.C700020017=0?AND?T2.C710020022<(sysdate-TO_DATE(''19700101'',''yyyymmdd''))*86400-28800?THEN?''已接单''?ELSE?''未结单''?END
)=?''
------解决方案--------------------
''{10}''' END from dual