Search code examples
oracle-databasereporting-servicesoracle11gssrs-2008

How to trim right two characters from a string/number in Oracle


I want to only trim the rightmost two characters in a string.

here is the code for the field that I want to trim:

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

for example, if the api call returns 1136, it will round to 1100. I want the end result to return '11'

I am in SSRS query editor.


Solution

  • this should do the job

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

    or in detail

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