Skip to content
Advertisement

selected splitted value in oracle

I have two columns A, B in oracle where A value has values like that xx-target-xx xx any data but target is exists

i neet to return only ‘target’ from text i tired this

but the result returns xx not target

Advertisement

Answer

Use REGEXP_SUBSTR. You want the second string of any characters except the minus sign:

Using INSTR and SUBSTR instead is a tad more complicated, but possible of course:

Demo: https://dbfiddle.uk/?rdbms=oracle_18&fiddle=e75b878bbd6300e9207cd698bb3029ec

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement