Title: String manipulation
select
substr(subject,1,instr(subject,'~')-1) first,
substr(subject,instr(subject,'~')+1, instr(subject,'~',1,2)-(instr(subject,'~'))-1) second,
substr(subject,instr(subject,'~',1,2)+1,length(subject)) third
from test_table
where test_column=1700455
/
 
Ray
-----Original Message-----
From: Stefick Ronald S Contr ESC/HRIDA [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 11:29 PM
To: Multiple recipients of list ORACLE-L
Subject: String manipulation

I'm trying to separate a string into 3 values:
The string is:
mystr1~mystr2~mystr3

Here is the code so far:
  1  select substr(subject,1,instr(subject,'~')-1) first,
  2  substr(subject,instr(subject,'~')+1, instr(subject,'~',1,2)-1) second,
  3  substr(subject,instr(subject,'~',1,2)+1,length(subject))
  4  from test_table
  5  where test_column=1700455

The result I get is:
mystr1
mystr2~mystr3
mystr3

The result I want is:
mystr1
mystr2
Mystr3

TIA,

Scott Stefick
MILPDS OCP Oracle DBA
[EMAIL PROTECTED]
210-565-2540


___________________________________________________________________________



This email and any attached to it are confidential and intended only for the individual or entity to which it is addressed. If you are not the intended recipient, please let us know by telephoning or emailing the sender. You should also delete the email and any attachment from your systems and should not copy the email or any attachment or disclose their content to any other person or entity. The views expressed here are not necessarily those of Churchill Insurance Group plc or its affiliates or subsidiaries. Thank you.


Churchill Insurance Group plc. Company Registration Number - 2280426. England.


Registered Office: Churchill Court, Westmoreland Road, Bromley, Kent BR1 1DP.



Reply via email to