I need to derive last 2 numbers after the '-' from the code column.
example if the code is 76767-99 then I need a query to return only 99. I am using substr and instr functions but not getting what I want. Please help me correct the below query.
code - 76767-99

select NVL (TRIM (SUBSTR (code,
                                             (INSTR (code,
                                                     '_'
                                                    )
                                             )
                                           + 1
                                          )
                                  ),
                             '0'
                            ) from temp_table;

Thanks,

Try the following sample code.

SELECT code,substr(code,instr(code,'-',1)+1,2) from table_name;

Thanks for your help