Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Look for a value inside an string

Status
Not open for further replies.

Raul2005

Programmer
Sep 23, 2005
44
US
I need some help to:

ID USERNAME MESSage
1 nrj hello(nrj)there is a..
2 pqt hola(nrj) today we had
3 nrj Try one more(nrj)time


I need the following resul

ID USERNAME MESSage STATUS
1 nrj hello(nrj)there SENT
2 pqt hola(nrj) today we RECEIVED
3 nrj Try one more(nrj) SENT

As you can see I need to look inside the message string for the value I have in field USERNAME Ineed to compare and if inside the message string I found a value like the USERNAME I need to display another field with tthe status set to SENT in other case it will be se to Received.

I will appreciate any help

Raul
 
Raul,

Here is some code that you can use:
Code:
Select id
      ,username
      ,message
      ,decode(instr(message,username)
             ,0,'RECEIVED'
             ,'SENT'
             ) status
from my_table
order by id;
Let us know how this code works for you.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[ Providing low-cost remote Database Admin services]
Click here to join Utah Oracle Users Group on Tek-Tips if you use Oracle in Utah USA.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top