擅长:python、mysql、java
<p>或者你可以用regex来实现这个</p>
<pre><code>txt = r"""
HELLO SET("ui_mapping_text"='#cast(
#sum(cast(STG_HO.TOTAL_ORDER,\'decimal(8,0)\')-cast(STG_HO.TAX,\'decimal(8,0)\'))/100
#+
#sum(cast(STG_HO.TOTAL_DISCOUNT,\'decimal(8,0)\'))/100
#+
#sum(cast(STG_HO.GST_DISCOUNT,\'decimal(8,0)\'))/100, \'decimal(10,2)\')
cast(
sum(cast(STG_HO.TOTAL_ORDER,\'decimal(8,0)\')-cast(STG_HO.TAX,\'decimal(8,0)\'))/100
+
sum(cast(STG_HO.TOTAL_DISCOUNT,\'decimal(8,0)\'))/100
+
sum(cast(nvl(STG_HO.GST_DISCOUNT,0),\'decimal(8,0)\'))/100, \'decimal(10,2)\')')
HELLO
"""
import re
result = re.sub(r"SET\((?s).*\)","",txt)
print (result)
</code></pre>
<p>结果:</p>
<pre><code>HELLO
HELLO
</code></pre>