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

Home -> Community -> Usenet -> c.d.o.server -> Re: sqlldr Question

Re: sqlldr Question

From: Richard Kuhler <noone_at_nowhere.com>
Date: Tue, 21 May 2002 19:12:35 GMT
Message-ID: <D_wG8.1080$wj7.217475@twister.socal.rr.com>


I've used this trick before. Create a view for the target table with an 'instead of insert' trigger on it. Have the trigger perform the insert/update as necessary. Then just use the view as the target for sql*ldr...

create table t (id number, val varchar2(30));

create or replace view t_merge as select * from t;

create or replace trigger trg_t_merge
instead of insert on t_merge
begin

    update t set

        val = :new.val
    where id = :new.id;     

    if sql%rowcount = 0 then

        insert into t (
            id,
            val
        ) values (
            :new.id,
            :new.val
        );

    end if;

end;

Richard

Sunil wrote:
>
> I need to load some data into a table from a file.
> Later The file may undergo some changes and these changes will have to be
> reflected in the table. There is a pk column in the table (name) .
> How can I go about this.
>
> Thanks,
> Sunil.
Received on Tue May 21 2002 - 14:12:35 CDT

Original text of this message

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