1 Reply Latest reply: Jul 2, 2013 4:47 AM by Anbarasan-Oracle RSS

    Need sql repalce

    Anbarasan-Oracle

      Hi All,

        I have query below

      select 'AP_AHSRINIV_ODAllSystemsSalesRepNR_SYS-OD-IN_MUGHAI_INH'  a from dual

      union

        select 'AP_AHSRINIV_INHR' a  from dual

        union

         select 'AP_ODAllSystemsSalesRepNR_SYS-OD-IN_MUGHAI_SMD'  a FROM DUAL

      ---------------------------------------

      in this table end of the  _INH data need take out sepreat..

      the out put should be ..

      ------------------------------

      a

      ----

      INH

      INHR

      SMD

      -------

        • 1. Re: Need sql repalce
          Ashu_Neo

          Like this?

          SQL> with dat as
            2  (
            3  select 'AP_AHSRINIV_ODAllSystemsSalesRepNR_SYS-OD-IN_MUGHAI_INH'  a from dual
            4  union all
            5  select 'AP_AHSRINIV_INHR' from dual
            6  union all
            7  select 'AP_ODAllSystemsSalesRepNR_SYS-OD-IN_MUGHAI_SMD' from dual
            8  )
            9  select substr(a,instr(a, '_',-1,1)+1) res from dat
          10  /

          RES
          -------------------------------------------------------
          INH
          INHR
          SMD