Home » SQL & PL/SQL » SQL & PL/SQL » Replacing text during parsing?
Replacing text during parsing? [message #11038] Tue, 02 March 2004 14:41 Go to next message
Spumoni
Messages: 3
Registered: March 2004
Junior Member
This is is really simple (for any pro)

Incoming text is something like:

grids: 12x32y

I need it to say

grid: 12x32y

What's the easiest way to fix this?
Re: Replacing text during parsing? [message #11039 is a reply to message #11038] Tue, 02 March 2004 14:45 Go to previous messageGo to next message
Spumoni
Messages: 3
Registered: March 2004
Junior Member
BTW, there are about 300+ msgs/day with an average of 8 of these errors in each, so it'll be a huge time-saver to get this fixed.
Re: Replacing text during parsing? [message #11040 is a reply to message #11038] Tue, 02 March 2004 15:59 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Is this data in a table? Data about to go in a table? I'm not sure what you mean by "incoming text."

If "c" is a variable or column name containing the original text ("grids"):

sql>select c, 
  2         replace(c, 'grids', 'grid') one_way,
  3         substr(c, 1, 4) || substr(c, 6) another_way,
  4         replace(c, 's:', ':') yet_another_way
  5    from (select 'grids: 12x32y' c from dual);
 
C             ONE_WAY                        ANOTHER_WAY  YET_ANOTHER_WAY
------------- ------------------------------ ------------ -------------
grids: 12x32y grid: 12x32y                   grid: 12x32y grid: 12x32y
Re: Replacing text during parsing? [message #11041 is a reply to message #11040] Tue, 02 March 2004 16:05 Go to previous messageGo to next message
Spumoni
Messages: 3
Registered: March 2004
Junior Member
The data is not yet in any table AFAIK, it is part of a raw text message that gets parsed so that locations and names of items, buildings, and locations can be placed on a map or searched for.
Re: Replacing text during parsing? [message #11042 is a reply to message #11041] Tue, 02 March 2004 19:17 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
You can just use the REPLACE function in PL/SQL then to strip out that 's'.
Previous Topic: Fetching arguments
Next Topic: Data Migration from SQL 7 Database to Oracle
Goto Forum:
  


Current Time: Wed Apr 24 00:48:31 CDT 2024