Home » SQL & PL/SQL » SQL & PL/SQL » Identiyfing firsts and last occurance of certain characters in a string-URGENT
Identiyfing firsts and last occurance of certain characters in a string-URGENT [message #21946] Thu, 12 September 2002 07:55 Go to next message
Sund
Messages: 6
Registered: May 2002
Junior Member
Hi

Have a column which may begin with **data**text.
Need to list data for all coumn, that is identyfing the information between the two occorance of **.

How can this be achieved?

Thanks in advance.
-Sund
Re: Identiyfing firsts and last occurance of certain characters in a string-URGENT [message #21947 is a reply to message #21946] Thu, 12 September 2002 08:34 Go to previous messageGo to next message
Mike T
Messages: 32
Registered: August 2002
Member
Try this:

SUBSTR(column,(INSTR(column,'**',1,1)+2),(INSTR(column,'**',1,2)-(INSTR(column,'**',1,1)+2)))

Use the INSTR function to find the start position and length values for your SUBSTR.

To find the starting point for your SUBSTR, you will find the position of the first occurence of '**' and add two to that (to skip the '**'. Say the '**' starts in position 3, you want the data that starts at position 5...add 2).

Then find the position of the second occurence of '**' and subtract your starting point (the position of the 1st occurence + 2). That should give you the length of your SUBSTR.

Untested and maybe too much code, but should work...
Re: Identiyfing firsts and last occurance of certain characters in a string-URGENT [message #21951 is a reply to message #21946] Thu, 12 September 2002 12:14 Go to previous message
Sund
Messages: 6
Registered: May 2002
Junior Member
Thanks Mike

It Worked!!!

Thanks
-Uma
Previous Topic: avoid unloading packages
Next Topic: Unable to Create Fixed length file with records having Umlaut Charachters
Goto Forum:
  


Current Time: Sat May 04 11:11:04 CDT 2024