When I let this Query run in my Oracle SQL Developer 1.5.3
select
COLUMNNAME ,
REPLACE( COLUMNNAME, 'BEFORESTRING', 'AFTERSTRING' )
as COLUMNNAME
from
TABLENAME
;
This ain't working. Does anyone know what's wr开发者_StackOverflow社区ong with the Query? Or maybe the Oracle DB Developer Tool has a bug?
Update: I want to change the table not only print out a regex match.
Try:
update tablename
set columnname = REPLACE( COLUMNNAME, 'BEFORESTRING', 'AFTERSTRING' ) ;
That will change all rows unless you add a WHERE clause. If there is a lot of data this would be more efficient:
update tablename
set columnname = REPLACE( COLUMNNAME, 'BEFORESTRING', 'AFTERSTRING' )
where columnname like '%BEFORESTRING%';
精彩评论