Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Global edit of table

Re: Global edit of table

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Wed, 27 Jun 2001 12:45:19 -0700
Message-ID: <F001.0033AB04.20010627121705@fatcity.com>

John Dunn wrote:
>
> I would like to be able to amend all occurences of a string in all columns
> of all rows of a table.
>
> Can I do this, without specifying individual column names?
>
> Please note that the string may include forward slashes /
>
> John
>

John,

   If you do not want to specify column names then you need a 'double action' query, eg something such as  

  set pause off
  set echo off
  set verify off
  set pagesize 0
  set feedback off
  set recsep off
  spool tally_ho.sql
  select decode(rownum, 1, 'update &&my_table set ',

                             ', ') || column_name
                                   || ' = replace(' || column_name 
                                   || ', <suitable stuff>);'
  from user_tab_columns
  where table_name = upper('&&my_table')     and column_type in ('CHAR', 'VARCHAR2');   spool off
  set echo on
  set feedback on
  @tally_ho  

  That's basically the idea.

-- 
Regards,

Stephane Faroult
Oriole Corporation
Voice:  +44  (0) 7050-696-269 
Fax:    +44  (0) 7050-696-449 
Performance Tools & Free Scripts
--------------------------------------------------------------
http://www.oriole.com, designed by Oracle DBAs for Oracle DBAs
--------------------------------------------------------------
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Jun 27 2001 - 14:45:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US