SQL Language (MOSC)

MOSC Banner

Substr And Instr

edited Feb 23, 2010 10:53AM in SQL Language (MOSC) 6 commentsAnswered
 Hi All,

In the below query is not displaying exact result,

select trim(substr('Person:1234 business group:xyz abc',

decode(instr( 'Person:1234 business group:xyz abc','business group:'),0,length('Person:1234 business group:xyz abc'),instr('Person:1234 business group:xyz abc','business group:'))+15

,decode(instr(substr('Person:1234 business group:xyz abc',

instr('Person:1234 business group:xyz abc','business group:')+15

,length('Person:1234 business group:xyz abc')

)

,' ')

,0

,length('Person:1234 business group:xyz abc')

,instr('Person:1234 business group:xyz abc','business group:')+15

,length('Person:1234 business group:xyz abc')

)

,' ')

)

)) from dual;

o/p : xyz

I am expecting o/p like xyz abc

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center