Home » SQL & PL/SQL » SQL & PL/SQL » Update a Substr
Update a Substr [message #7062] Mon, 19 May 2003 12:52 Go to next message
Jim Renaud
Messages: 6
Registered: May 2003
Junior Member
How can I update just a portion of a Column?
I tried "Update (table) set substr(column, position, number)"
That doesn't work.
Thanks - Jim
Re: Update a Substr [message #7063 is a reply to message #7062] Mon, 19 May 2003 13:01 Go to previous messageGo to next message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
quote from Jim Renaud:
----------------------------------------------------------------------
How can I update just a portion of a Column?
I tried "Update (table) set substr(column, position, number)"
That doesn't work.
Thanks - Jim  

----------------------------------------------------------------------
SQL> SELECT x FROM t;
  
X
----------
000ABC
000DEF
000GHI
000JKL
000MNO
000PQR
000STU
000VWX
  
8 rows selected.
  
SQL> <font color=red>UPDATE t</font>
  2  <font color=red>SET    x = SUBSTR(x,4,6)</font>
  3  /
  
8 rows updated.
  
SQL> COMMIT;
  
Commit complete.
  
SQL> SELECT x FROM t;
  
X
----------
ABC
DEF
GHI
JKL
MNO
PQR
STU
VWX
  
8 rows selected.
  
SQL> 
Good luck,

A
Re: Update a Substr [message #7069 is a reply to message #7063] Mon, 19 May 2003 16:58 Go to previous messageGo to next message
Jim Renaud
Messages: 6
Registered: May 2003
Junior Member
Art
That worked - Thanks - Jim
Re: Update a Substr [message #7180 is a reply to message #7062] Mon, 26 May 2003 23:33 Go to previous message
Girimohan
Messages: 5
Registered: May 2003
Junior Member
create table a(eno varchar2(6));

insert into a values('E10');
insert into a values('E11');
insert into a values('E12');
insert into a values('E13');

SELECT * FROM A;

eno
---------
E10
E11
E12
E13

suppose i want to replace the 'E' in the table with 'EM' then

UPDATE A SET ENO='EM'||SUBSTR(eno,2)

SELECT * FROM A;

eno
---------
EM10
EM11
EM12
EM13

Regards
Giri
Previous Topic: ODBC Response time
Next Topic: How to get value of an XML element from a Field ?
Goto Forum:
  


Current Time: Fri Apr 26 15:53:00 CDT 2024