Re: DBMS_REDEFINITION usage

From: Martin Berger <martin.a.berger_at_gmail.com>
Date: Sat, 29 Oct 2016 16:27:34 +0200
Message-ID: <CALH8A937W5z94UY-d809PfYYG+5R8K4txak1tCSXfNuBmYQehw_at_mail.gmail.com>



Interesting, and thank you for sharing!

Just for mycuriousity: Why didn't you just add the new column, set a default value to to_date('12/31/2999','mm/dd/yyyy') and update all the columns where changed_indicator=1 ?
I guess this should be less load, but obviously risks some impact on PCT-free, chained rows or similar.

Martin

2016-10-28 22:11 GMT+02:00 Andrew Kerber <andrew.kerber_at_gmail.com>:

> After some research, I did figure out how to do this. I use the
> col_mapping option in the start_redef_table procedure, something like this:
>
> col_mapping=>'decode(changed_indicator,1,date_added,to_
> date('12/31/2999','mm/dd/yyyy')) change_date,date_added date_added,...'
>
> Obviously I had to do a little playing around with string manipulation to
> put it in the line properly, but it does work.
>
> On Fri, Oct 28, 2016 at 9:02 AM, Andrew Kerber <andrew.kerber_at_gmail.com>
> wrote:
>
>> I cant quite visualize how to do this. I need to use dbms_redefinition
>> to add a column to a table. In the process, I want to put a value in the
>> column based on a condition.eg, I want to add a column called
>> changed_date, and if the changed_indicator column is 1, I want to populate
>> the value with date_added, otherwise I want to put a high value in the
>> column.
>>
>> Once the redefinition process is complete, the column will be maintained
>> by our software, but I cant quite figure out how to do this on the fly
>> without missing the records modified while dbms_redefinition is running.
>>
>> Has anyone done this? Am I missing something easy here?
>>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Sat Oct 29 2016 - 16:27:34 CEST

Original text of this message