Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: String manipulation

RE: String manipulation

From: Feighery Raymond <Raymond.Feighery_at_churchill.com>
Date: Tue, 27 Jan 2004 06:29:26 -0800
Message-ID: <F001.005DE341.20040127062926@fatcity.com>


Content-Type: text/plain;
 charset="iso-8859-1"

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-----
[mailto:Ronald.Stefick_at_RANDOLPH.AF.MIL]
Sent: Monday, January 26, 2004 11:29 PM
To: Multiple recipients of list ORACLE-L

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
scott.stefick_at_randolph.af.mil
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.

------_=_NextPart_001_01C3E4E1.AE287A6E
Content-Type: text/html;
 charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<TITLE>String manipulation</TITLE>

<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3D"Courier New"><FONT size=3D2><FONT face=3DArial=20
color=3D#0000ff>select</FONT> </FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New"><FONT size=3D2><FONT face=3DArial=20
color=3D#0000ff>substr(subject,1,instr(subject,'~')-1) first,</FONT>=20
</FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New"><FONT size=3D2><FONT face=3DArial=20
color=3D#0000ff>substr(subject,instr(subject,'~')+1,=20 instr(subject,'~',1,2)-(instr(subject,'~'))-1) second,</FONT>=20
</FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New"><FONT size=3D2><FONT face=3DArial=20
color=3D#0000ff>substr(subject,instr(subject,'~',1,2)+1,length(subject))= =20
third</FONT> </FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New"><FONT size=3D2><FONT face=3DArial =
color=3D#0000ff>from=20
test_table</FONT> </FONT></FONT></DIV>
<DIV><SPAN class=3D436392514-27012004><FONT face=3DArial =
color=3D#0000ff size=3D2>where=20
test_column=3D1700455</FONT></SPAN></DIV>
<DIV><FONT face=3D"Courier New"><FONT size=3D2><FONT face=3DArial=20
color=3D#0000ff>/</FONT> </FONT></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Ray</FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT = face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> Stefick Ronald S = Contr=20
  ESC/HRIDA [mailto:Ronald.Stefick_at_RANDOLPH.AF.MIL]<BR><B>Sent:</B> = Monday,=20
  January 26, 2004 11:29 PM<BR><B>To:</B> Multiple recipients of list=20   ORACLE-L<BR><B>Subject:</B> String manipulation<BR><BR></FONT></DIV>   <P><FONT face=3DArial size=3D2>I'm trying to separate a string into 3 =

  values:</FONT> <BR><FONT face=3DArial size=3D2>The string is:</FONT> =
<BR><FONT=20

  face=3DArial size=3D2>mystr1~mystr2~mystr3</FONT> </P>   <P><FONT face=3DArial size=3D2>Here is the code so far:</FONT> =
<BR><FONT=20

  face=3DArial size=3D2>&nbsp; 1&nbsp; select = substr(subject,1,instr(subject,'~')-1)=20   first,</FONT> <BR><FONT face=3DArial size=3D2>&nbsp; 2&nbsp;=20   substr(subject,instr(subject,'~')+1, instr(subject,'~',1,2)-1) = second,</FONT>=20
  <BR><FONT face=3DArial size=3D2>&nbsp; 3&nbsp;=20   substr(subject,instr(subject,'~',1,2)+1,length(subject))</FONT> =
<BR><FONT=20

  face=3DArial size=3D2>&nbsp; 4&nbsp; from test_table</FONT> <BR><FONT = face=3DArial=20
  size=3D2>&nbsp; 5&nbsp; where test_column=3D1700455</FONT> </P>   <P><FONT face=3DArial size=3D2>The result I get is:</FONT> <BR><FONT = face=3DArial=20
  size=3D2>mystr1</FONT> <BR><FONT face=3DArial = size=3D2>mystr2~mystr3</FONT>=20
  <BR><FONT face=3DArial size=3D2>mystr3</FONT> </P>   <P><FONT face=3DArial size=3D2>The result I want is:</FONT> <BR><FONT = face=3DArial=20
  size=3D2>mystr1</FONT> <BR><FONT face=3DArial size=3D2>mystr2</FONT> =
<BR><FONT=20

  face=3DArial size=3D2>Mystr3</FONT> </P>   <P><FONT face=3DArial size=3D2>TIA,</FONT> </P>   <P><FONT face=3D"Monotype Corsiva">Scott Stefick</FONT> <BR><FONT = face=3DArial=20

  size=3D2>MILPDS OCP Oracle DBA</FONT> <BR><FONT face=3DArial=20
  size=3D2>scott.stefick_at_randolph.af.mil</FONT> <BR><FONT face=3DArial=20
  size=3D2>210-565-2540</FONT> </P></BLOCKQUOTE></BODY></HTML>

<BR>

<P><FONT SIZE=3D2 =

FACE=3D"Arial">_________________________________________________________=
__________________ </FONT></P>

<BR>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial">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. </FONT></P>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial">Churchill Insurance Group plc. =
Company Registration Number - 2280426. England. </FONT></P>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial">Registered Office: Churchill Court, =
Westmoreland Road, Bromley, Kent BR1 1DP. </FONT></P>
<BR>
<BR>

------_=_NextPart_001_01C3E4E1.AE287A6E--

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Feighery Raymond
  INET: Raymond.Feighery_at_churchill.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jan 27 2004 - 08:29:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US