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: Insert PK to another database

Re: Insert PK to another database

From: Anurag Varma <avdbi_at_hotmail.com>
Date: Tue, 25 Feb 2003 22:50:28 -0500
Message-ID: <v5oec9lan2pq62@corp.supernews.com>


> OR
> * re-think whether you actually need to preserve the PK.
should come in the end. I hastily added this in the middle of my explanation :)

Anurag

"Anurag Varma" <avdbi_at_hotmail.com> wrote in message news:v5oe3qscs4sieb_at_corp.supernews.com...
> What you have Mr. David, is autonumbering implemented via a trigger:
>
> To do what you want to do, you need to either:
>
> * Disable the trigger using alter trigger <triggername>@link_name disable;
> However it will disable the trigger for *ALL* users/sessions
> OR
> * Write a simple package in target schema like:
> create or replace package trigger_disable;
> gv_disable_mytrigger boolean default FALSE;
> end;
> /
> OR
> * re-think whether you actually need to preserve the PK.
>
> and then code your trigger logic in target schema .. like this:
> begin
> if (trigger_disable.gv_disable_mytrigger) then
> return;
> end if;
> .... rest of logic
>
> and then disable the trigger in your session by issuing this before the insert:
> begin
> trigger_disable.gv_disable_trigger_at_link_name := true;
> end;
> /
>
> Anurag
>
> "David Nguyen" <nguyend4_at_hotmail.com> wrote in message news:9a0092d.0302251917.d74ea07_at_posting.google.com...
> > Hi all,
> >
> > I have another challenge. I insert a certain rows from one database
> > to another by using insert SQL
> >
> > SQL>insert into target_table select * from source_table_at_link_name
> > where PK = '15';
> >
> > 1 rows inserted
> >
> > However, it insert into the target_table of my new database with new
> > PK number and I have to go inside and manually edit the PK. Is there
> > a way that I can keep the same PK number by using insert without going
> > inside the table update manually?
> >
> > Thanks
> >
> > David
>
>
Received on Tue Feb 25 2003 - 21:50:28 CST

Original text of this message

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