2016-06-21 10 views
1

文字列の右端の2文字をトリミングしたいだけです。オラクルの文字列/数字から右に2文字を切り取る方法

は、ここで私はトリミングしたいフィールドのコードです:

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

例えば

、 api呼び出しが1136を返す場合、それは1100に丸めるでしょう。私は最終結果が '11'を返すようにします。

私はSSRSクエリエディタにいます。

答えて

1

これはあなたがスケールをシフトするために100であなたの番号を分割し、その結果、ラウンドすることができます仕事

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

を実行する必要があります。

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 
関連する問題