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

Home -> Community -> Usenet -> c.d.o.misc -> Re: how to update a list of tables using native dynamic sql?

Re: how to update a list of tables using native dynamic sql?

From: G Quesnel <dbaguy_ott_at_yahoo.com>
Date: 20 Apr 2005 13:30:39 -0700
Message-ID: <1114029039.016656.151170@z14g2000cwz.googlegroups.com>


In both statement, you include the trailing semi-colon, which should not be inserted into your SQL string.
Here is a sample ...
Declare
begin

   for i in ( select table_name from user_tables

               where table_name in ('T1','T2') loop
       execute immediate 'Update '||i.table_name||
                         '   set created_date=sysdate,'||

' last_modified_date=sysdate,'||
' created_userid=''sale'','||
' last_modified_userid=''sale''';
commit; dbms_output.put_line( 'Updated -> ' || i.tables);
    end loop;
end;
/ Received on Wed Apr 20 2005 - 15:30:39 CDT

Original text of this message

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