Home » RDBMS Server » Server Administration » Text Manipulation
Text Manipulation [message #371509] Tue, 31 October 2000 09:00 Go to next message
amish modi
Messages: 1
Registered: October 2000
Junior Member
In a text string how one can change a character at a particular position ? (The character is repeated various times in a string but only the character at particular position should be changed)
Re: Text Manipulation [message #371514 is a reply to message #371509] Wed, 01 November 2000 07:10 Go to previous messageGo to next message
Just Me
Messages: 10
Registered: November 2000
Junior Member
let's say that :
t - the table
v - the varchar field
3 - the position
'C'-the new char
update t set v=decode(length(v)<3,v,left(v,3-1)||'C'||substr(v,3+1))
Re: Text Manipulation [message #371543 is a reply to message #371509] Fri, 03 November 2000 13:26 Go to previous message
Amit Chauhan
Messages: 74
Registered: July 1999
Member
Hi,
Am not sure if theres a function called 'left' in Oracle as written by 'Just Me'. Anyway, you can use this SQL also :
Assume you want to change the character at 3rd position to x :

select substr('amit', 1, 3 - 1) || 'x' || substr('amit', 3 + 1)
from dual

Hope it helps
Thanks
Amit
Previous Topic: Can someone help me with the prompts command?
Next Topic: Need help - 3 questions pls.
Goto Forum:
  


Current Time: Wed May 01 23:44:44 CDT 2024