2016-06-21 53 views
1

我只想修整字符串中最右边的两个字符。如何在Oracle中修整右边的两个字符/字符串

这里是我要修剪的字段中的代码:

`ROUND(ifsapp.customer_order_api.get_gross_amt_incl_charges(c.order_no), - 2))

例如,如果api调用返回1136,则它将轮到1100.我希望最终结果返回'11'

我在SSRS查询编辑器中。

回答

1

本应该做的工作

SELECT SUBSTR('your string',1,2) FROM dual; 

或详细

substr(ROUND(ifsapp.customer_order_api.get_gross_amt_incl_charges(c.order_no),-2)),1,2) 
0

您可以通过100除以你的电话号码,以规模移位,轮结果:

ROUND(ifsapp.customer_order_api.get_gross_amt_incl_charges(c.order_no)/100)) 

用一些演示值:

with t(x) as (
    select 1136 from dual 
    union all select 145 from dual 
    union all select 98765 from dual 
) 
select x, round(x/100) as y 
from t; 

     X  Y 
-------- -------- 
    1136  11 
    145  1 
    98765  988 
相关问题