0

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,

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by debasisdas
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.